Skip to content

Commit

Permalink
Revert macro
Browse files Browse the repository at this point in the history
  • Loading branch information
VersusFacit committed Feb 27, 2024
1 parent 00c0ba5 commit f7d1079
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions dbt/include/redshift/macros/materializations/table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,15 @@
{% if existing_relation is not none %}
{% if existing_relation.can_be_renamed %}
{{ adapter.rename_relation(existing_relation, backup_relation) }}
{{ adapter.rename_relation(intermediate_relation, target_relation) }}

{% else %}
BEGIN
drop table if exists {{ existing_relation }} cascade;
alter table {{ intermediate_relation }} rename to {{ target_relation }}
{{ adapter.commit() }}
{% else %}
{{ drop_relation_if_exists(existing_relation) }}
{% endif %}
{% endif %}
{% else %}
{{ adapter.rename_relation(intermediate_relation, target_relation) }}
{% endif %}


{{ adapter.rename_relation(intermediate_relation, target_relation) }}

{% do create_indexes(target_relation) %}

{{ run_hooks(post_hooks, inside_transaction=True) }}
Expand Down

0 comments on commit f7d1079

Please sign in to comment.