Skip to content

Commit

Permalink
Adap 108/fix renamed relations for 1.8 (#109)
Browse files Browse the repository at this point in the history
Co-authored-by: Mila Page <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
  • Loading branch information
4 people authored Mar 21, 2024
1 parent 35bd362 commit 59cb168
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240226-224046.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Add field wrapper to BaseRelation members that were missing it.
time: 2024-02-26T22:40:46.271694-08:00
custom:
Author: versusfacit
Issue: "108"
4 changes: 2 additions & 2 deletions dbt/adapters/base/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class BaseRelation(FakeAPIObject, Hashable):
# adding a relation type here also requires defining the associated rename macro
# e.g. adding RelationType.View in dbt-postgres requires that you define:
# include/postgres/macros/relations/view/rename.sql::postgres__get_rename_view_sql()
renameable_relations: SerializableIterable = ()
renameable_relations: SerializableIterable = field(default_factory=frozenset)

# register relation types that are atomically replaceable, e.g. they have "create or replace" syntax
# adding a relation type here also requires defining the associated replace macro
# e.g. adding RelationType.View in dbt-postgres requires that you define:
# include/postgres/macros/relations/view/replace.sql::postgres__get_replace_view_sql()
replaceable_relations: SerializableIterable = ()
replaceable_relations: SerializableIterable = field(default_factory=frozenset)

def _is_exactish_match(self, field: ComponentName, value: str) -> bool:
if self.dbt_created and self.quote_policy.get_part(field) is False:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ actually executes the drop, and `get_drop_sql`, which returns the template.
*/ #}

{% macro drop_materialized_view(relation) -%}
{{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}
{{- adapter.dispatch('drop_materialized_view', 'dbt')(relation) -}}
{%- endmacro %}


Expand Down
2 changes: 1 addition & 1 deletion dbt/include/global_project/macros/relations/table/drop.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ actually executes the drop, and `get_drop_sql`, which returns the template.
*/ #}

{% macro drop_table(relation) -%}
{{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}
{{- adapter.dispatch('drop_table', 'dbt')(relation) -}}
{%- endmacro %}


Expand Down
2 changes: 1 addition & 1 deletion dbt/include/global_project/macros/relations/view/drop.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ actually executes the drop, and `get_drop_sql`, which returns the template.
*/ #}

{% macro drop_view(relation) -%}
{{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}
{{- adapter.dispatch('drop_view', 'dbt')(relation) -}}
{%- endmacro %}


Expand Down

0 comments on commit 59cb168

Please sign in to comment.