Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize returning ResourceTypeSelector instances in dbt list and dbt build #10739

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/unreleased/Under the Hood-20240918-170325.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Under the Hood
body: Standardize returning `ResourceTypeSelector` instances in `dbt list` and `dbt
build`
time: 2024-09-18T17:03:25.639516-06:00
custom:
Author: dbeatty10
Issue: "10739"
7 changes: 0 additions & 7 deletions core/dbt/task/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,6 @@ def get_node_selector(self, no_unit_tests=False) -> ResourceTypeSelector:

resource_types = self.resource_types(no_unit_tests)

if resource_types == [NodeType.Test]:
return ResourceTypeSelector(
graph=self.graph,
manifest=self.manifest,
previous_state=self.previous_state,
resource_types=resource_types,
)
return ResourceTypeSelector(
graph=self.graph,
manifest=self.manifest,
Expand Down
24 changes: 8 additions & 16 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,24 +196,16 @@
else:
return self.args.select

def get_node_selector(self):
def get_node_selector(self) -> ResourceTypeSelector:
if self.manifest is None or self.graph is None:
raise DbtInternalError("manifest and graph must be set to get perform node selection")
if self.resource_types == [NodeType.Test]:
return ResourceTypeSelector(
graph=self.graph,
manifest=self.manifest,
previous_state=self.previous_state,
resource_types=self.resource_types,
)
else:
return ResourceTypeSelector(
graph=self.graph,
manifest=self.manifest,
previous_state=self.previous_state,
resource_types=self.resource_types,
include_empty_nodes=True,
)
return ResourceTypeSelector(

Check warning on line 202 in core/dbt/task/list.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/list.py#L202

Added line #L202 was not covered by tests
graph=self.graph,
manifest=self.manifest,
previous_state=self.previous_state,
resource_types=self.resource_types,
include_empty_nodes=True,
)

def interpret_results(self, results):
# list command should always return 0 as exit code
Expand Down
Loading