Skip to content

Commit

Permalink
Addressing #179, incremental models cannot full refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
prdpsvs committed Jun 21, 2024
1 parent 640f4be commit 6f5acc5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
{% set tmp_vw_relation = target_relation.incorporate(path={"identifier": target_relation.identifier ~ '__dbt_tmp_vw'}, type='view')-%}
-- Dropping temp view relation if it exists
{{ adapter.drop_relation(tmp_vw_relation) }}
-- Dropping target relation if exists
{{ adapter.drop_relation(target_relation) }}

{%- call statement('main') -%}
{{ get_create_table_as_sql(False, target_relation, sql)}}
Expand All @@ -38,6 +40,7 @@
{% else %}

{%- set temp_relation = make_temp_relation(target_relation)-%}
{{ adapter.drop_relation(temp_relation) }}
{% set tmp_tble_vw_relation = temp_relation.incorporate(path={"identifier": temp_relation.identifier ~ '__dbt_tmp_vw'}, type='view')-%}
-- Dropping temp view relation if it exists
{{ adapter.drop_relation(tmp_tble_vw_relation) }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% macro fabric__create_table_as(temporary, relation, sql) -%}

{% set tmp_vw_relation = relation.incorporate(path={"identifier": relation.identifier ~ '__dbt_tmp_vw'}, type='view')-%}
{% do adapter.drop_relation(tmp_vw_relation) %}
{{ get_create_view_as_sql(tmp_vw_relation, sql) }}

{% set contract_config = config.get('contract') %}
Expand All @@ -21,6 +22,4 @@
{%- else %}
EXEC('CREATE TABLE {{relation}} AS SELECT * FROM {{tmp_vw_relation}};');
{% endif %}
-- To clean up test_store tests
{% do adapter.drop_relation(tmp_vw_relation) %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@

{% macro build_snapshot_staging_table(strategy, temp_snapshot_relation, target_relation) %}
{% set temp_relation = make_temp_relation(target_relation) %}
{{ adapter.drop_relation(temp_relation) }}

{% set select = snapshot_staging_table(strategy, temp_snapshot_relation, target_relation) %}

{% set tmp_tble_vw_relation = temp_relation.incorporate(path={"identifier": temp_relation.identifier ~ '__dbt_tmp_vw'}, type='view')-%}
Expand Down

0 comments on commit 6f5acc5

Please sign in to comment.