Skip to content

Commit df292db

Browse files
committed
Update the metric.expr to be populated correctly according to DSI rules
1 parent 34c7343 commit df292db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/dbt/parser/schema_yaml_readers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,15 +635,17 @@ def _create_metric(
635635
semantic_model_name: str,
636636
meta: Optional[Dict[str, Any]] = None,
637637
) -> None:
638-
config = {"enabled": enabled}
638+
config: Dict[str, Any] = {"enabled": enabled}
639639
if meta is not None:
640640
# Need to propagate meta to metric from measure during create_metric: True
641641
config["meta"] = meta
642642
unparsed_metric = UnparsedMetric(
643643
name=measure.name,
644644
label=measure.label or measure.name,
645645
type="simple",
646-
type_params=UnparsedMetricTypeParams(measure=measure.name, expr=measure.name),
646+
type_params=UnparsedMetricTypeParams(
647+
measure=measure.name, expr=measure.expr or measure.name # type: ignore
648+
),
647649
description=measure.description or f"Metric created from measure {measure.name}",
648650
config=config,
649651
)

0 commit comments

Comments
 (0)