Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 5606a84

Browse files
committed
Update incremental.sql
1 parent e75ccd8 commit 5606a84

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

dbt/include/bigquery/macros/materializations/incremental.sql

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@
7070
{% endmacro %}
7171

7272

73-
{% macro generate_temp_schema(base_relation, temp_schema = none) %}
74-
{%- if temp_schema is not none-%}
75-
{%- set temp_relation = base_relation.incorporate(path={
76-
"schema": temp_schema
73+
{% macro generate_temp_schema(base_relation, tmp_schema = none) %}
74+
{%- if tmp_schema is not none-%}
75+
{%- set tmp_relation = base_relation.incorporate(path={
76+
"schema": tmp_schema
7777
}) -%}
78-
{%- do create_schema(temp_relation) -%}
78+
{%- do create_schema(tmp_relation) -%}
79+
{{ return(tmp_relation) }}
7980
{% endif %}
81+
{{ return(base_relation) }}
8082
{% endmacro %}
8183

8284
{% materialization incremental, adapter='bigquery', supported_languages=['sql', 'python'] -%}
@@ -88,8 +90,8 @@
8890

8991
{%- set target_relation = this %}
9092
{%- set existing_relation = load_relation(this) %}
91-
{%- set tmp_updated_relation = generate_tmp_schema(this, tmp_schema) -%}
92-
{%- set tmp_relation = make_temp_relation(tmp_updated_relation) %}
93+
{%- set tmp_set_schema = generate_tmp_schema(this, tmp_schema) -%}
94+
{%- set tmp_relation = make_temp_relation(tmp_set_schema) %}
9395

9496
{#-- Validate early so we don't run SQL if the strategy is invalid --#}
9597
{% set strategy = dbt_bigquery_validate_get_incremental_strategy(config) -%}

0 commit comments

Comments
 (0)