Skip to content

Commit

Permalink
fixing linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db committed Nov 8, 2023
1 parent d6c50d4 commit 881579b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
19 changes: 13 additions & 6 deletions dbt/adapters/databricks/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = []

Expand Down Expand Up @@ -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]] = []
Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/databricks/relation.py
Original file line number Diff line number Diff line change
@@ -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,
)
Expand Down Expand Up @@ -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}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 881579b

Please sign in to comment.