Skip to content

Commit

Permalink
add check to guarantee relations is populated
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Dec 16, 2023
1 parent bf6e910 commit 18d30f7
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions dbt/adapters/spark/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dataclasses import dataclass
from typing import Any, Dict, Iterable, List, Optional, Union, Type, Tuple, Callable, Set

from dbt.adapters.base.relation import InformationSchema, SchemaSearchMap
from dbt.adapters.base.relation import InformationSchema
from dbt.adapters.capability import CapabilityDict, CapabilitySupport, Support, Capability
from dbt.contracts.graph.manifest import Manifest

Expand Down Expand Up @@ -384,26 +384,11 @@ def get_catalog(
def get_catalog_by_relations(
self, manifest: Manifest, relations: Set[BaseRelation]
) -> Tuple[agate.Table, List[Exception]]:
schema_map = SchemaSearchMap()
for relation in relations:
schema_map.add(relation)

with executor(self.config) as tpe:
futures: List[Future[agate.Table]] = []
for info, schemas in schema_map.items():
for schema in schemas:
futures.append(
tpe.submit_connected(
self,
schema,
self._get_one_catalog_by_relations,
info,
[schema],
manifest,
)
)
catalogs, exceptions = catch_as_completed(futures)
return catalogs, exceptions
if len(relations) == 0:
raise dbt.exceptions.CompilationError(
f"Expected non-empty set of relations, found " f"{relations}"
)
return self.get_catalog(manifest)

def _get_one_catalog(
self,
Expand Down

0 comments on commit 18d30f7

Please sign in to comment.