Skip to content

Commit

Permalink
Add fnMatch to group selectors (dbt-labs#9812)
Browse files Browse the repository at this point in the history
  • Loading branch information
heysweet authored Apr 3, 2024
1 parent f2a5ad0 commit a994ace
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
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

0 comments on commit a994ace

Please sign in to comment.