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

Set `default_granularity` properly for nested metrics #304

Closed courtneyholcomb closed 2 months ago

courtneyholcomb commented 2 months ago

Description

Previously, this transformation was not setting default granularity properly for metrics with input metrics (i.e., derived & ratio metrics). This is because Metric.measure_references only gets the top-level measures, not nested measures from input metrics. This PR fixes that bug by utilizing PydanticMetric.all_input_measures_for_metric() instead. Note that this feature (default_granularity) has not been released yet so no customers should be impacted by this bug.

Checklist

courtneyholcomb commented 2 months ago

Should we make it so that that method shows all measures for derived metrics? I would think it might break something tho

@WilliamDee 🤔 doesn't it do that already?? That's why this fix worked!

WilliamDee commented 2 months ago

Should we make it so that that method shows all measures for derived metrics? I would think it might break something tho

@WilliamDee 🤔 doesn't it do that already?? That's why this fix worked!

nvm i mixed it with the other function (all_input_measures_for_metric) you created!