diff --git a/.changes/unreleased/Features-20240323-201230.yaml b/.changes/unreleased/Features-20240323-201230.yaml new file mode 100644 index 00000000000..3f981ecc7b3 --- /dev/null +++ b/.changes/unreleased/Features-20240323-201230.yaml @@ -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" diff --git a/core/dbt/graph/selector_methods.py b/core/dbt/graph/selector_methods.py index bc51ddba22a..25d3af0d493 100644 --- a/core/dbt/graph/selector_methods.py +++ b/core/dbt/graph/selector_methods.py @@ -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 diff --git a/tests/unit/test_graph_selector_methods.py b/tests/unit/test_graph_selector_methods.py index ee2c2c4d968..52013fd409d 100644 --- a/tests/unit/test_graph_selector_methods.py +++ b/tests/unit/test_graph_selector_methods.py @@ -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")