Skip to content

Commit

Permalink
[CT-3013] Fix parsing of window_groupings (#8454) (#8455)
Browse files Browse the repository at this point in the history
* Update semantic model parsing tests to check measure non_additive_dimension spec

* Make `window_groupings` default to empty list if not specified on `non_additive_dimension`

* Add changie doc for `window_groupings`  parsing fix
  • Loading branch information
QMalcolm authored and emmyoop committed Aug 23, 2023
1 parent a618792 commit 38ac08e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230818-095348.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Ensure parsing does not break when `window_groupings` is not specified for `non_additive_dimension`
time: 2023-08-18T09:53:48.154848-07:00
custom:
Author: QMalcolm
Issue: "8453"
2 changes: 1 addition & 1 deletion core/dbt/contracts/graph/unparsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class UnparsedEntity(dbtClassMixin):
class UnparsedNonAdditiveDimension(dbtClassMixin):
name: str
window_choice: str # AggregationType enum
window_groupings: List[str]
window_groupings: List[str] = field(default_factory=list)


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
agg_time_dimension: ds
agg_params:
percentile: 0.99
- name: test_non_additive
expr: txn_revenue
agg: sum
non_additive_dimension:
name: ds
window_choice: max
dimensions:
- name: ds
Expand Down Expand Up @@ -125,7 +131,7 @@ def test_semantic_model_parsing(self, project):
semantic_model.node_relation.relation_name
== f'"dbt"."{project.test_schema}"."fct_revenue"'
)
assert len(semantic_model.measures) == 5
assert len(semantic_model.measures) == 6

def test_semantic_model_error(self, project):
# Next, modify the default schema.yml to remove the semantic model.
Expand Down

0 comments on commit 38ac08e

Please sign in to comment.