Skip to content

Commit

Permalink
database disabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
dataders committed May 2, 2024
1 parent 7dd6752 commit 1667800
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dbt/adapters/synapse/relation_configs/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SynapseRelationType(StrEnum):


class SynapseIncludePolicy(Policy):
database: bool = True
database: bool = False
schema: bool = True
identifier: bool = True

Expand Down
16 changes: 8 additions & 8 deletions dbt/include/synapse/macros/adapters/relation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -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) %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

0 comments on commit 1667800

Please sign in to comment.