metricflow
metricflow copied to clipboard
[Bug] Inconsistent `label` requirements between metrics
Is this a new bug in metricflow?
- [X] I believe this is a new bug in metricflow
- [X] I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
When you define a metric via create_metric: true you do not have to specify the label
property. This is valid configuration:
semantic_models:
- name: fact_order_event
model: ref('fact_order_event')
defaults:
agg_time_dimension: order_event_created_date
entities:
- name: order_event
expr: order_event_id
type: primary
measures:
- name: count_order_events
expr: 1
agg: sum
create_metric: true
dimensions:
- name: order_event_created_date
type: time
type_params:
time_granularity: day
- name: event_type
type: categorical
When you add another metric, defined independently in YML, for example:
metrics:
- name: count_order_rescheduled_events
type: simple
type_params:
measure: count_order_events
filter: |
{{ Dimension('order_event__event_type') }} = 'order_rescheduled'
You will get a parsing error: 'label' is a required property
Expected Behavior
Do not require the label property on metrics either. Without a label all the semantic layer users (documentation sites, metrics catalogs, BI tools) will default to the metric name. Regardless of where metrics get defined, they have similar properties.
Steps To Reproduce
Try this on any semantic model.
Relevant log output
No response
Environment
- OS: Mac
- Python: 3.11
- dbt: 1.8
- metricflow: 0.206.0
Which database are you using?
other (mention it in "Additional Context")
Additional Context
Databricks/Spark