diff --git a/dbt/adapters/synapse/relation_configs/policies.py b/dbt/adapters/synapse/relation_configs/policies.py index 1e4de62f..acf5556f 100644 --- a/dbt/adapters/synapse/relation_configs/policies.py +++ b/dbt/adapters/synapse/relation_configs/policies.py @@ -11,7 +11,7 @@ class SynapseRelationType(StrEnum): class SynapseIncludePolicy(Policy): - database: bool = True + database: bool = False schema: bool = True identifier: bool = True diff --git a/dbt/include/synapse/macros/adapters/relation.sql b/dbt/include/synapse/macros/adapters/relation.sql index 9dd4cf12..493deaa2 100644 --- a/dbt/include/synapse/macros/adapters/relation.sql +++ b/dbt/include/synapse/macros/adapters/relation.sql @@ -12,14 +12,14 @@ {% set object_id_type = 'U' %} {%- else -%} invalid target name {% endif %} - if object_id ('{{ relation.include(database=False) }}','{{ object_id_type }}') is not null + if object_id ('{{ relation }}','{{ object_id_type }}') is not null {% if relation.type == 'view' or relation.type == 'materialized_view' -%} begin - drop view {{ relation.include(database=False) }} + drop view {{ relation }} end {% elif relation.type == 'table' %} begin - drop {{ relation.type }} {{ relation.include(database=False) }} + drop {{ relation.type }} {{ relation }} end {% endif %} {% else %} @@ -39,17 +39,17 @@ {% macro synapse__rename_relation_script(from_relation, to_relation) -%} -- drop all object types with to_relation.identifier name, to avoid error "new name already in use...duplicate...not permitted" - if object_id ('{{ to_relation.include(database=False) }}','V') is not null + if object_id ('{{ to_relation }}','V') is not null begin - drop view {{ to_relation.include(database=False) }} + drop view {{ to_relation }} end - if object_id ('{{ to_relation.include(database=False) }}','U') is not null + if object_id ('{{ to_relation }}','U') is not null begin - drop table {{ to_relation.include(database=False) }} + drop table {{ to_relation }} end - rename object {{ from_relation.include(database=False) }} to {{ to_relation.identifier }} + rename object {{ from_relation }} to {{ to_relation.identifier }} {% endmacro %} {% macro synapse__truncate_relation(relation) %} diff --git a/dbt/include/synapse/macros/materializations/models/table/create_table_constraints.sql b/dbt/include/synapse/macros/materializations/models/table/create_table_constraints.sql index 7ae3650e..76a04137 100644 --- a/dbt/include/synapse/macros/materializations/models/table/create_table_constraints.sql +++ b/dbt/include/synapse/macros/materializations/models/table/create_table_constraints.sql @@ -12,6 +12,6 @@ {# loop through user_provided_columns to create DDL with data types and constraints #} {%- set raw_model_constraints = adapter.render_raw_model_constraints(raw_constraints=model['constraints']) -%} {% for c in raw_model_constraints -%} - alter table {{ relation.include(database=False) }} {{c}}; + alter table {{ relation }} {{c}}; {% endfor -%} {% endmacro %} diff --git a/dbt/include/synapse/macros/materializations/models/view/create_view_as.sql b/dbt/include/synapse/macros/materializations/models/view/create_view_as.sql index 7deee62e..94fa4719 100644 --- a/dbt/include/synapse/macros/materializations/models/view/create_view_as.sql +++ b/dbt/include/synapse/macros/materializations/models/view/create_view_as.sql @@ -10,6 +10,6 @@ {{ get_assert_columns_equivalent(sql) }} {%- endif %} - EXEC('create view {{ relation.include(database=False) }} as {{ temp_view_sql }};'); + EXEC('create view {{ relation }} as {{ temp_view_sql }};'); {% endmacro %}