Skip to content

Commit

Permalink
allow optional tablemetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke committed May 29, 2024
1 parent e4524f3 commit 012195f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dbt/adapters/base/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,9 @@ def get_columns_in_relation(self, relation: BaseRelation) -> List[BaseColumn]:
raise NotImplementedError("`get_columns_in_relation` is not implemented for this adapter!")

@abc.abstractmethod
def get_relation_metadata(self, relation: BaseRelation) -> Tuple[TableMetadata, StatsDict]:
def get_relation_metadata(
self, relation: BaseRelation
) -> Tuple[Optional[TableMetadata], StatsDict]:
"""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
4 changes: 3 additions & 1 deletion dbt/adapters/sql/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ def get_columns_in_relation(self, relation):
GET_COLUMNS_IN_RELATION_MACRO_NAME, kwargs={"relation": relation}
)

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

def create_schema(self, relation: BaseRelation) -> None:
Expand Down

0 comments on commit 012195f

Please sign in to comment.