diff --git a/core/dbt/include/global_project/macros/materializations/archive/archive.sql b/core/dbt/include/global_project/macros/materializations/archive/archive.sql index 604b6492e03..67e99a72b25 100644 --- a/core/dbt/include/global_project/macros/materializations/archive/archive.sql +++ b/core/dbt/include/global_project/macros/materializations/archive/archive.sql @@ -188,7 +188,7 @@ {%- set identifier = model['alias'] -%} - {%- set tmp_identifier = identifier + '__dbt_archival_tmp' -%} + {%- set tmp_identifier = model['name'] + '__dbt_archival_tmp' -%} {% set tmp_table_sql -%} diff --git a/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql b/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql index 438b3a066c3..e0a3ce51e2a 100644 --- a/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql +++ b/core/dbt/include/global_project/macros/materializations/incremental/incremental.sql @@ -16,7 +16,7 @@ {%- set unique_key = config.get('unique_key') -%} {%- set identifier = model['alias'] -%} - {%- set tmp_identifier = identifier + '__dbt_incremental_tmp' -%} + {%- set tmp_identifier = model['name'] + '__dbt_incremental_tmp' -%} {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%} {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database, type='table') -%} diff --git a/core/dbt/include/global_project/macros/materializations/table/table.sql b/core/dbt/include/global_project/macros/materializations/table/table.sql index 2e76017fbb3..d12062c50a9 100644 --- a/core/dbt/include/global_project/macros/materializations/table/table.sql +++ b/core/dbt/include/global_project/macros/materializations/table/table.sql @@ -1,7 +1,7 @@ {% materialization table, default %} {%- set identifier = model['alias'] -%} - {%- set tmp_identifier = identifier + '__dbt_tmp' -%} - {%- set backup_identifier = identifier + '__dbt_backup' -%} + {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%} + {%- set backup_identifier = model['name'] + '__dbt_backup' -%} {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%} {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%} diff --git a/core/dbt/include/global_project/macros/materializations/view/view.sql b/core/dbt/include/global_project/macros/materializations/view/view.sql index f5c68963444..2fa2a672678 100644 --- a/core/dbt/include/global_project/macros/materializations/view/view.sql +++ b/core/dbt/include/global_project/macros/materializations/view/view.sql @@ -1,8 +1,8 @@ {%- materialization view, default -%} {%- set identifier = model['alias'] -%} - {%- set tmp_identifier = identifier + '__dbt_tmp' -%} - {%- set backup_identifier = identifier + '__dbt_backup' -%} + {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%} + {%- set backup_identifier = model['name'] + '__dbt_backup' -%} {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%} {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%} diff --git a/plugins/snowflake/dbt/include/snowflake/macros/materializations/table.sql b/plugins/snowflake/dbt/include/snowflake/macros/materializations/table.sql index 51806e7b2df..7219d0aa0ac 100644 --- a/plugins/snowflake/dbt/include/snowflake/macros/materializations/table.sql +++ b/plugins/snowflake/dbt/include/snowflake/macros/materializations/table.sql @@ -1,7 +1,7 @@ {% materialization table, adapter='snowflake' %} {%- set identifier = model['alias'] -%} - {%- set tmp_identifier = identifier + '__dbt_tmp' -%} - {%- set backup_identifier = identifier + '__dbt_backup' -%} + {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%} + {%- set backup_identifier = model['name'] + '__dbt_backup' -%} {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%} {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}