From 7bf19341f6219db5df8bee052558b8c7b77af3e3 Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:22:18 -0700 Subject: [PATCH] Create temporary views with 'or replace' (#906) * Create temporary views with 'or replace' * Add changie --------- Co-authored-by: annaazizyan --- .changes/unreleased/Features-20231011-094718.yaml | 6 ++++++ dbt/include/spark/macros/adapters.sql | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Features-20231011-094718.yaml diff --git a/.changes/unreleased/Features-20231011-094718.yaml b/.changes/unreleased/Features-20231011-094718.yaml new file mode 100644 index 000000000..8503a70b8 --- /dev/null +++ b/.changes/unreleased/Features-20231011-094718.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Create temporary views with 'or replace' +time: 2023-10-11T09:47:18.485764-07:00 +custom: + Author: annazizian + Issue: "350" diff --git a/dbt/include/spark/macros/adapters.sql b/dbt/include/spark/macros/adapters.sql index 9e277dd68..bfc1f198d 100644 --- a/dbt/include/spark/macros/adapters.sql +++ b/dbt/include/spark/macros/adapters.sql @@ -138,7 +138,7 @@ {#-- We can't use temporary tables with `create ... as ()` syntax --#} {% macro spark__create_temporary_view(relation, compiled_code) -%} - create temporary view {{ relation }} as + create or replace temporary view {{ relation }} as {{ compiled_code }} {%- endmacro -%}