diff --git a/dbt/adapters/databricks/impl.py b/dbt/adapters/databricks/impl.py index 651c6deba..0fcf2dc3f 100644 --- a/dbt/adapters/databricks/impl.py +++ b/dbt/adapters/databricks/impl.py @@ -428,15 +428,22 @@ def parse_columns_from_information( # type: ignore[override] columns.append(column) return columns - def get_catalog(self, manifest: Manifest) -> Tuple[Table, List[Exception]]: - catalog_relations = self._get_catalog_relations(manifest) - return self.get_catalog_by_relations(manifest, catalog_relations) + def get_catalog( + self, manifest: Manifest, selected_nodes: Optional[Set[Any]] = None + ) -> Tuple[Table, List[Exception]]: + if selected_nodes: + relations: Set[BaseRelation] = { + self.Relation.create_from(self.config, n) for n in selected_nodes + } + else: + relations = set(self._get_catalog_relations(manifest)) + return self.get_catalog_by_relations(manifest, relations) def get_catalog_by_relations( - self, manifest: Manifest, relations: Set[BaseRelation] = None + self, manifest: Manifest, catalog_relations: Set[BaseRelation] ) -> Tuple[Table, List[Exception]]: with executor(self.config) as tpe: - relations_by_catalog = self._get_catalog_relations_by_info_schema(relations) + relations_by_catalog = self._get_catalog_relations_by_info_schema(catalog_relations) futures: List[Future[Table]] = [] @@ -474,7 +481,7 @@ def get_catalog_by_relations( def _get_hive_catalog( self, schema: str, - relations: List[BaseRelation], + relations: Set[BaseRelation], ) -> Table: table_names = extract_identifiers(relations) columns: List[Dict[str, Any]] = [] diff --git a/dbt/adapters/databricks/relation.py b/dbt/adapters/databricks/relation.py index 63309e951..29dd60634 100644 --- a/dbt/adapters/databricks/relation.py +++ b/dbt/adapters/databricks/relation.py @@ -1,5 +1,5 @@ from dataclasses import dataclass, field -from typing import Any, Dict, List, Optional, Set, Type +from typing import Any, Dict, Optional, Set, Type from dbt.contracts.relation import ( ComponentName, ) @@ -141,5 +141,5 @@ def is_hive_metastore(database: Optional[str]) -> bool: return database is None or database.lower() == "hive_metastore" -def extract_identifiers(relations: List[BaseRelation]) -> Set[str]: +def extract_identifiers(relations: Set[BaseRelation]) -> Set[str]: return {r.identifier for r in relations if r.identifier is not None} diff --git a/requirements.txt b/requirements.txt index b4d9ee9a1..0ab8c31f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ databricks-sql-connector>=2.9.3, <3.0.0 -dbt-spark==1.7.0 +dbt-spark==1.7.1 databricks-sdk==0.9.0 keyring>=23.13.0 diff --git a/setup.py b/setup.py index f22b0118e..7e7bfde10 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def _get_plugin_version(): packages=find_namespace_packages(include=["dbt", "dbt.*"]), include_package_data=True, install_requires=[ - "dbt-spark==1.7.0", + "dbt-spark==1.7.1", "databricks-sql-connector>=2.9.3, <3.0.0", "databricks-sdk>=0.9.0", "keyring>=23.13.0",