Skip to content

Commit

Permalink
include_empty_nodes for list task selector
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Jun 21, 2023
1 parent 7c22be4 commit 51da375
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/dbt/graph/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ def __init__(
graph: Graph,
manifest: Manifest,
previous_state: Optional[PreviousState] = None,
include_empty_nodes: bool = False,
):
super().__init__(manifest, previous_state)
self.full_graph = graph
self.include_empty_nodes = include_empty_nodes

# build a subgraph containing only non-empty, enabled nodes and enabled
# sources.
Expand Down Expand Up @@ -167,7 +169,11 @@ def _is_graph_member(self, unique_id: UniqueId) -> bool:
metric = self.manifest.metrics[unique_id]
return metric.config.enabled
node = self.manifest.nodes[unique_id]
return not node.empty and node.config.enabled

if self.include_empty_nodes:
return node.config.enabled
else:
return not node.empty and node.config.enabled

def node_is_match(self, node: GraphMemberNode) -> bool:
"""Determine if a node is a match for the selector. Non-match nodes
Expand Down Expand Up @@ -313,11 +319,13 @@ def __init__(
manifest: Manifest,
previous_state: Optional[PreviousState],
resource_types: List[NodeType],
include_empty_nodes: bool = False,
):
super().__init__(
graph=graph,
manifest=manifest,
previous_state=previous_state,
include_empty_nodes=include_empty_nodes,
)
self.resource_types: Set[NodeType] = set(resource_types)

Expand Down
1 change: 1 addition & 0 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def get_node_selector(self):
manifest=self.manifest,
previous_state=self.previous_state,
resource_types=self.resource_types,
include_empty_nodes=True,
)

def interpret_results(self, results):
Expand Down

0 comments on commit 51da375

Please sign in to comment.