Skip to content

Commit

Permalink
restore default behaviour for make_unique_id_map
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Jan 25, 2024
1 parent cd2bafc commit 5634453
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/dbt/task/docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ def add_column(self, data: PrimitiveDict):
table.columns[column.name] = column

def make_unique_id_map(
self, manifest: Manifest, selected_node_ids: Set[UniqueId]
self, manifest: Manifest, selected_node_ids: Optional[Set[UniqueId]] = None
) -> Tuple[Dict[str, CatalogTable], Dict[str, CatalogTable]]:
"""
Create mappings between CatalogKeys and CatalogTables for nodes and sources, filteded by selected_node_ids.
By default, selected_node_ids is None and all nodes and sources defined in the manifest are included in the mappings.
"""
nodes: Dict[str, CatalogTable] = {}
sources: Dict[str, CatalogTable] = {}

Expand All @@ -125,7 +130,7 @@ def make_unique_id_map(
key = table.key()
if key in node_map:
unique_id = node_map[key]
if unique_id in selected_node_ids:
if selected_node_ids is None or unique_id in selected_node_ids:
nodes[unique_id] = table.replace(unique_id=unique_id)

unique_ids = source_map.get(table.key(), set())
Expand All @@ -137,7 +142,7 @@ def make_unique_id_map(
table.to_dict(omit_none=True),
)
else:
if unique_id in selected_node_ids:
if selected_node_ids is None or unique_id in selected_node_ids:
sources[unique_id] = table.replace(unique_id=unique_id)
return nodes, sources

Expand Down Expand Up @@ -242,10 +247,11 @@ def run(self) -> CatalogArtifact:
if self.manifest is None:
raise DbtInternalError("self.manifest was None in run!")

selected_node_ids: Set[UniqueId] = set()
selected_node_ids: Optional[Set[UniqueId]] = None
if self.args.empty_catalog:
catalog_table: agate.Table = agate.Table([])
exceptions: List[Exception] = []
selected_node_ids = set()
else:
adapter = get_adapter(self.config)
with adapter.connection_named("generate_catalog"):
Expand Down

0 comments on commit 5634453

Please sign in to comment.