diff --git a/core/dbt/contracts/graph/nodes.py b/core/dbt/contracts/graph/nodes.py index 4da91653561..07016e1416c 100644 --- a/core/dbt/contracts/graph/nodes.py +++ b/core/dbt/contracts/graph/nodes.py @@ -1746,7 +1746,7 @@ def same_contents(self, old: Optional["SemanticModel"]) -> bool: @dataclass class SavedQueryMandatory(GraphNode): metrics: List[str] - group_bys: List[str] + group_by: List[str] where: Optional[WhereFilterIntersection] @@ -1769,8 +1769,8 @@ def depends_on_nodes(self): def same_metrics(self, old: "SavedQuery") -> bool: return self.metrics == old.metrics - def same_group_bys(self, old: "SavedQuery") -> bool: - return self.group_bys == old.group_bys + def same_group_by(self, old: "SavedQuery") -> bool: + return self.group_by == old.group_by def same_description(self, old: "SavedQuery") -> bool: return self.description == old.description @@ -1795,7 +1795,7 @@ def same_contents(self, old: Optional["SavedQuery"]) -> bool: return ( self.same_metrics(old) - and self.same_group_bys(old) + and self.same_group_by(old) and self.same_description(old) and self.same_where(old) and self.same_label(old) diff --git a/core/dbt/contracts/graph/unparsed.py b/core/dbt/contracts/graph/unparsed.py index aee95e5dfd7..8a7b9ea34fa 100644 --- a/core/dbt/contracts/graph/unparsed.py +++ b/core/dbt/contracts/graph/unparsed.py @@ -727,7 +727,7 @@ class UnparsedSavedQuery(dbtClassMixin): description: Optional[str] = None label: Optional[str] = None metrics: List[str] = field(default_factory=list) - group_bys: List[str] = field(default_factory=list) + group_by: List[str] = field(default_factory=list) where: Optional[Union[str, List[str]]] = None config: Dict[str, Any] = field(default_factory=dict) diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py index 01f6ae5c893..fd94d34b098 100644 --- a/core/dbt/parser/manifest.py +++ b/core/dbt/parser/manifest.py @@ -1113,7 +1113,7 @@ def process_saved_queries(self, config: RuntimeConfig): for saved_query in self.manifest.saved_queries.values(): # TODO: # 1. process `where` of SavedQuery for `depends_on`s - # 2. process `group_bys` of SavedQuery for `depends_on`` + # 2. process `group_by` of SavedQuery for `depends_on`` _process_metrics_for_node(self.manifest, current_project, saved_query) def update_semantic_model(self, semantic_model) -> None: diff --git a/core/dbt/parser/schema_yaml_readers.py b/core/dbt/parser/schema_yaml_readers.py index 0e9eb1cb75f..88722f51f85 100644 --- a/core/dbt/parser/schema_yaml_readers.py +++ b/core/dbt/parser/schema_yaml_readers.py @@ -694,7 +694,7 @@ def parse_saved_query(self, unparsed: UnparsedSavedQuery) -> None: description=unparsed.description, label=unparsed.label, fqn=fqn, - group_bys=unparsed.group_bys, + group_by=unparsed.group_by, metrics=unparsed.metrics, name=unparsed.name, original_file_path=self.yaml.path.original_file_path, diff --git a/tests/functional/saved_queries/fixtures.py b/tests/functional/saved_queries/fixtures.py index 8097193065e..d3316e36bc2 100644 --- a/tests/functional/saved_queries/fixtures.py +++ b/tests/functional/saved_queries/fixtures.py @@ -11,7 +11,7 @@ label: Test Saved Query metrics: - simple_metric - group_bys: + group_by: - "Dimension('user__ds')" where: - "{{ Dimension('user__ds', 'DAY') }} <= now()" diff --git a/tests/functional/saved_queries/test_saved_query_parsing.py b/tests/functional/saved_queries/test_saved_query_parsing.py index 51975e9970b..aee7fd7c23d 100644 --- a/tests/functional/saved_queries/test_saved_query_parsing.py +++ b/tests/functional/saved_queries/test_saved_query_parsing.py @@ -36,7 +36,7 @@ def test_semantic_model_parsing(self, project): saved_query = manifest.saved_queries["saved_query.test.test_saved_query"] assert saved_query.name == "test_saved_query" assert len(saved_query.metrics) == 1 - assert len(saved_query.group_bys) == 1 + assert len(saved_query.group_by) == 1 assert len(saved_query.where.where_filters) == 2 assert len(saved_query.depends_on.nodes) == 1 assert saved_query.description == "My SavedQuery Description" diff --git a/tests/unit/test_graph_selector_methods.py b/tests/unit/test_graph_selector_methods.py index 143d2a72eab..5e67144e1e0 100644 --- a/tests/unit/test_graph_selector_methods.py +++ b/tests/unit/test_graph_selector_methods.py @@ -470,7 +470,7 @@ def make_saved_query(pkg: str, name: str, metric: str, path=None): path=path, description="Test Saved Query", metrics=[metric], - group_bys=[], + group_by=[], where=None, unique_id=f"saved_query.{pkg}.{name}", original_file_path=path,