dbt-labs / dbt-semantic-interfaces

The shared semantic layer definitions that dbt-core and MetricFlow use.
Apache License 2.0
66 stars 13 forks source link

Add `default_granularity` to metric spec #291

Closed courtneyholcomb closed 2 months ago

courtneyholcomb commented 2 months ago

Resolves #290

Description

Now that we are enabling sub-daily granularities, the current behavior of metric_time will likely be unexpected to users. If they change any of their time dimensions to use a grain smaller than DAY, metric_time will default to that grain. To avoid this confusion, add a parameter that allows users to choose which grain they want their metric to default to. This will default to DAY if not set to avoid the unexpected behavior change. (If DAY is smaller than the defined granularity, will default to the smallest available granularity.)

Checklist

tlento commented 2 months ago

I think this branch needs an update, will hold off until the cumulative metrics pieces are through.