Skip to content

Commit

Permalink
use correct type signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke committed May 28, 2024
1 parent a841a11 commit 754e5c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 1 addition & 2 deletions dbt/adapters/base/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,7 @@ def get_columns_in_relation(self, relation: BaseRelation) -> List[BaseColumn]:
raise NotImplementedError("`get_columns_in_relation` is not implemented for this adapter!")

@abc.abstractmethod
@available.parse_list
def get_relation_metadata(self, relation: BaseRelation) -> List[BaseColumn]:
def get_relation_metadata(self, relation: BaseRelation) -> Tuple[Any, Any]:
"""Get metadata about a relation's materialization (e.g., materialization type, size, number of rows)."""
raise NotImplementedError("`get_relation_metadata` is not implemented for this adapter!")

Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/sql/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get_columns_in_relation(self, relation):
GET_COLUMNS_IN_RELATION_MACRO_NAME, kwargs={"relation": relation}
)

def get_relation_metadata(self, relation):
def get_relation_metadata(self, relation) -> Tuple[Any, Any]:
return self.execute_macro(GET_RELATION_METADATA_NAME, kwargs={"relation": relation})

def create_schema(self, relation: BaseRelation) -> None:
Expand Down
9 changes: 9 additions & 0 deletions dbt/include/global_project/macros/adapters/metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}
{% endmacro %}

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

{% macro default__get_relation_metadata(relation) %}
{{ exceptions.raise_not_implemented(
'get_relation_metadata macro not implemented for adapter '+adapter.type()) }}
{% endmacro %}

{% macro get_relations() %}
{{ return(adapter.dispatch('get_relations', 'dbt')()) }}
{% endmacro %}
Expand Down

0 comments on commit 754e5c0

Please sign in to comment.