Skip to content

Commit

Permalink
Update replace.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
prdpsvs authored May 24, 2024
1 parent acdbd8f commit 636c62e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dbt/include/synapse/macros/adapters/replace.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
{{ get_create_intermediate_sql(target_relation, sql) }};
{{ get_create_backup_sql(existing_relation) }};
{{ get_rename_intermediate_sql(target_relation) }};
{{ synapse__drop_relation(existing_relation) }}
{% do adapter.drop_relation(existing_relation) %}

{# /* create target_relation as an intermediate relation, then swap it out with the existing one without using a backup */ #}
{%- elif target_relation.can_be_renamed -%}
{{ get_create_intermediate_sql(target_relation, sql) }};
{{ synapse__drop_relation(existing_relation) }};
{% do adapter.drop_relation(existing_relation) %}
{{ get_rename_intermediate_sql(target_relation) }}

{# /* create target_relation in place by first backing up the existing relation */ #}
{%- elif existing_relation.can_be_renamed -%}
{{ get_create_backup_sql(existing_relation) }};
{{ get_create_sql(target_relation, sql) }};
{{ synapse__drop_relation(existing_relation) }}
{% do adapter.drop_relation(existing_relation) %}

{# /* no renaming is allowed, so just drop and create */ #}
{%- else -%}
{{ synapse__drop_relation(existing_relation) }};
{% do adapter.drop_relation(existing_relation) %}
{{ get_create_sql(target_relation, sql) }}

{%- endif -%}
Expand Down

0 comments on commit 636c62e

Please sign in to comment.