Skip to content

Commit

Permalink
Add possible implementation for CT-1498
Browse files Browse the repository at this point in the history
  • Loading branch information
stu-k committed Apr 11, 2023
1 parent 3620127 commit 9579cc7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/dbt/adapters/base/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,24 @@ def list_relations(self, database: Optional[str], schema: str) -> List[BaseRelat
# we can't build the relations cache because we don't have a
# manifest so we can't run any operations.
relations = self.list_relations_without_caching(schema_relation)

# if the cache is already populated, add this schema in
# otherwise, skip updating the cache and just ignore
if self.cache:
for relation in relations:
self.cache.add(relation)
if not relations:
# it's possible that there were no relations in some schemas. We want
# to insert the schemas we query into the cache's `.schemas` attribute
# so we can check it later

# Jeremy: what was the intent behind this inner loop?
# cache_update: Set[Tuple[Optional[str], Optional[str]]] = set()
# for relation in cache_schemas:
# cache_update.add((database, schema))

self.cache.update_schemas(set((database, schema)))

fire_event(
ListRelations(
database=cast_to_str(database),
Expand Down

0 comments on commit 9579cc7

Please sign in to comment.