From 1f439e225d40d216cdaac50307bd6c93fd81f41c Mon Sep 17 00:00:00 2001 From: Pradeep Srikakolapu Date: Fri, 24 May 2024 06:00:54 -0700 Subject: [PATCH] Update create_table_as.sql --- .../materializations/models/table/create_table_as.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dbt/include/synapse/macros/materializations/models/table/create_table_as.sql b/dbt/include/synapse/macros/materializations/models/table/create_table_as.sql index ac27d7c..036cf54 100644 --- a/dbt/include/synapse/macros/materializations/models/table/create_table_as.sql +++ b/dbt/include/synapse/macros/materializations/models/table/create_table_as.sql @@ -6,9 +6,8 @@ type='view')-%} {%- set temp_view_sql = sql.replace("'", "''") -%} - {{ synapse__drop_relation_script(tmp_relation) }} - - {{ synapse__drop_relation_script(relation) }} + {% do adapter.drop_relation(tmp_relation) %} + {% do adapter.drop_relation(relation) %} {{ synapse__create_view_as(tmp_relation, sql) }} @@ -39,6 +38,6 @@ EXEC('CREATE TABLE [{{relation.database}}].[{{relation.schema}}].[{{relation.identifier}}]WITH(DISTRIBUTION = {{dist}},{{index}}) AS (SELECT * FROM [{{tmp_relation.database}}].[{{tmp_relation.schema}}].[{{tmp_relation.identifier}}]);'); {% endif %} - {{ synapse__drop_relation_script(tmp_relation) }} + {% do adapter.drop_relation(tmp_relation) %} {% endmacro %}