Skip to content

Commit

Permalink
changing destination
Browse files Browse the repository at this point in the history
Update incremental.sql
  • Loading branch information
borjavb committed Jan 8, 2025
1 parent a219818 commit d2c6789
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20250108-204100.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: allow changing the schema destination of tmp tables
time: 2025-01-08T20:41:00.190868Z
custom:
Author: borjavb
Issue: "1443"
10 changes: 9 additions & 1 deletion dbt/include/bigquery/macros/materializations/incremental.sql
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,20 @@
{% materialization incremental, adapter='bigquery', supported_languages=['sql', 'python'] -%}

{%- set unique_key = config.get('unique_key') -%}
{%- set temp_schema = config.get('temp_schema') -%}
{%- set full_refresh_mode = (should_full_refresh()) -%}
{%- set language = model['language'] %}

{%- set target_relation = this %}
{%- set existing_relation = load_relation(this) %}
{%- set tmp_relation = make_temp_relation(this) %}
{%- set temp_schema = config.get('temp_schema') -%}
{%- if temp_schema is not none-%}
{%- set temp_relation = this.incorporate(path={
"schema": temp_schema
}) -%}
{%- do create_schema(temp_relation) -%}
{% endif %}
{%- set tmp_relation = make_temp_relation(temp_relation) %}

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

0 comments on commit d2c6789

Please sign in to comment.