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

Add fnMatch to group selectors #9812

Merged
merged 5 commits into from
Apr 3, 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
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240323-201230.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Add wildcard support to the group selector method
time: 2024-03-23T20:12:30.715975-04:00
custom:
Author: heysweet
Issue: "9811"
3 changes: 2 additions & 1 deletion core/dbt/graph/selector_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ class GroupSelectorMethod(SelectorMethod):
def search(self, included_nodes: Set[UniqueId], selector: str) -> Iterator[UniqueId]:
"""yields nodes from included in the specified group"""
for unique_id, node in self.groupable_nodes(included_nodes):
if selector == node.config.get("group"):
node_group = node.config.get("group")
if node_group and fnmatch(node_group, selector):
yield unique_id


Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_graph_selector_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ def test_select_group(manifest, view_model):
assert method.arguments == []

assert search_manifest_using_method(manifest, method, group_name) == {"view_model"}
assert search_manifest_using_method(manifest, method, "my?group") == {"view_model"}
assert not search_manifest_using_method(manifest, method, "not_my_group")


Expand Down