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

[CT-3013] [Bug] non_additive_dimension property window_groupings should be optional but isn't #8453

Closed
2 tasks done
QMalcolm opened this issue Aug 18, 2023 · 0 comments · Fixed by #8454
Closed
2 tasks done
Assignees
Labels
bug Something isn't working semantic Issues related to the semantic layer

Comments

@QMalcolm
Copy link
Contributor

QMalcolm commented Aug 18, 2023

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Currently if you specify a measure with a non_additive_dimension that doesn't have a window_groupings property you get an error. The work around is to specify an empty list, i.e. window_groupings: []

Expected Behavior

No error should be raised if window_groupings isn't specified

Steps To Reproduce

  1. Add a non_additive_dimension measure to a semantic model
semantic_models
  - name: your_semantic_model
  ...
  measures:
    - name: test_non_additive
       agg: sum
       expr: lifetime_spend_pretax
       non_additive_dimension:
         name: first_ordered_at
         window_choice: max
  1. Run dbt parse
  2. Get an error like the following
16:02:24  Encountered an error:
Parsing Error
  Invalid semantic_models config given in FilePath(searched_path='models', relative_path='marts/customers.yml', modification_time=1691182373.747098, project_root='/Users/quigleymalcolm/Developer/dbt-labs/jaffle-sl-template') @ semantic_models: {'name': 'your_semantic_model, 'defaults': {'agg_time_dimension': 'first_ordered_at'}, 'description': 'Customer grain mart.\n', 'model': "ref('customers')", 'entities': [{'name': 'customer', 'expr': 'customer_id', 'type': 'primary'}], 'dimensions': [{'name': 'customer_name', 'type': 'categorical'}, {'name': 'customer_type', 'type': 'categorical'}, {'name': 'first_ordered_at', 'type': 'time', 'type_params': {'time_granularity': 'day'}}, {'name': 'last_ordered_at', 'type': 'time', 'type_params': {'time_granularity': 'day'}}], 'measures': [{'name': 'count_lifetime_orders', 'description': 'Total count of orders per customer.', 'agg': 'sum'}, {'name': 'lifetime_spend_pretax', 'description': 'Customer lifetime spend before taxes.', 'agg': 'sum'}, {'name': 'lifetime_spend', 'agg': 'sum', 'description': 'Gross customer lifetime spend inclusive of taxes.'}, {'name': 'test_non_additive', 'agg': 'sum', 'expr': 'lifetime_spend_pretax', 'non_additive_dimension': {'name': 'customer_type', 'window_choice': 'max'}}]} - at path ['measures'][3]['non_additive_dimension']: {'name': 'customer_type', 'window_choice': 'max'} is not valid under any of the given schemas

Relevant log output

See above

Environment

- OS: macOS Ventura 13.4.1
- Python: 3.8.10
- dbt: 1.6.0

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

@QMalcolm QMalcolm added bug Something isn't working triage semantic Issues related to the semantic layer labels Aug 18, 2023
@QMalcolm QMalcolm self-assigned this Aug 18, 2023
@github-actions github-actions bot changed the title [Bug] non_additive_dimension property window_groupings should be optional but isn't [CT-3013] [Bug] non_additive_dimension property window_groupings should be optional but isn't Aug 18, 2023
@QMalcolm QMalcolm removed the triage label Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semantic Issues related to the semantic layer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant