Skip to content

Commit

Permalink
Use get_relation_metadata from dbt-common
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke committed May 29, 2024
1 parent d19e3ef commit 2213a16
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dbt/adapters/snowflake/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
LIST_RELATIONS_MACRO_NAME,
GET_RELATION_METADATA_NAME,
)
from dbt_common.artifacts.catalog import TableMetadata, StatsDict, StatsItem
from dbt_common.contracts.metadata import TableMetadata, StatsDict, StatsItem

from dbt.adapters.snowflake import SnowflakeConnectionManager
from dbt.adapters.snowflake import SnowflakeRelation
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _plugin_version() -> str:
packages=find_namespace_packages(include=["dbt", "dbt.*"]),
include_package_data=True,
install_requires=[
"dbt-common>=1.0.4,<2.0",
"dbt-common>=1.2.0,<2.0",
"dbt-adapters>=1.1.1,<2.0",
"snowflake-connector-python[secure-local-storage]~=3.0",
# add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency
Expand Down
7 changes: 5 additions & 2 deletions tests/unit/mock_adapter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from contextlib import contextmanager
from typing import List
from typing import Tuple, Optional
from unittest import mock

from dbt.adapters.base import BaseAdapter, BaseRelation
from dbt_common.contracts.metadata import TableMetadata, StatsDict


def adapter_factory():
Expand Down Expand Up @@ -34,7 +35,9 @@ def rename_relation(self, *args, **kwargs):
def get_columns_in_relation(self, *args, **kwargs):
return self.responder.get_columns_in_relation(*args, **kwargs)

def get_relation_metadata(self, relation: BaseRelation) -> List[BaseRelation]:
def get_relation_metadata(
self, relation: BaseRelation
) -> Tuple[Optional[TableMetadata], StatsDict]:
return self.responder.get_relation_metadata(relation)

def expand_column_types(self, *args, **kwargs):
Expand Down

0 comments on commit 2213a16

Please sign in to comment.