Skip to content

Commit

Permalink
adding temp relation to table materialization to support temp view dr…
Browse files Browse the repository at this point in the history
…op relation
  • Loading branch information
prdpsvs committed May 27, 2024
1 parent 35110fe commit 8cc9227
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,19 @@
-- `BEGIN` happens here:
{{ run_hooks(pre_hooks, inside_transaction=True) }}

-- creating a temp relation
{% set tmp_relation = target_relation.incorporate(
path={"identifier": target_relation.identifier.replace("#", "") ~ '_temp_view'},
type='view')-%}

-- build model
{% call statement('main') -%}
{{ get_create_table_as_sql(False, target_relation, sql) }}
{%- endcall %}

-- drop temp relation
{% do adapter.drop_relation(tmp_relation) %}

-- cleanup
{{ run_hooks(post_hooks, inside_transaction=True) }}
{% do apply_grants(target_relation, grant_config, should_revoke=should_revoke) %}
Expand Down

0 comments on commit 8cc9227

Please sign in to comment.