Skip to content

Commit

Permalink
Merge pull request #1872 from fishtown-analytics/fix/bigquery-snowfla…
Browse files Browse the repository at this point in the history
…ke-unknown-relation-types

Fix bigquery snowflake unknown relation types
  • Loading branch information
beckjake authored Oct 30, 2019
2 parents 76dc41b + 2f85d83 commit 8239f9c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 0 additions & 8 deletions core/dbt/adapters/base/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,6 @@ def __eq__(self, other):
def get_default_quote_policy(cls: Type[Self]) -> Policy:
return cls._get_field_named('quote_policy').default

@classmethod
def get_default_include_policy(cls: Type[Self]) -> Policy:
return cls._get_field_named('include_policy').default

@classmethod
def get_relation_type_class(cls: Type[Self]) -> Type[RelationType]:
return cls._get_field_named('type')

def get(self, key, default=None):
"""Override `.get` to return a metadata object so we don't break
dbt_utils.
Expand Down
4 changes: 4 additions & 0 deletions core/dbt/adapters/sql/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ def list_relations_without_caching(self, information_schema, schema):
'identifier': True
}
for _database, name, _schema, _type in results:
try:
_type = self.Relation.RelationType(_type)
except ValueError:
_type = self.Relation.RelationType.External
relations.append(self.Relation.create(
database=_database,
schema=_schema,
Expand Down
5 changes: 4 additions & 1 deletion plugins/bigquery/dbt/adapters/bigquery/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ def _bq_table_to_relation(self, bq_table):
'schema': True,
'identifier': True
},
type=self.RELATION_TYPES.get(bq_table.table_type))
type=self.RELATION_TYPES.get(
bq_table.table_type, RelationType.External
),
)

@classmethod
def warning_on_hooks(hook_type):
Expand Down

0 comments on commit 8239f9c

Please sign in to comment.