Skip to content

Commit

Permalink
Add context to AssertionError for derived metric expr (#1231)
Browse files Browse the repository at this point in the history
Customers have been hitting this assertion error with no context. Likely
this error was added with the assumption that validations would prevent
this case, but apparently that is not true. I'll also be following up on
the validations to make sure that gets handled in the future.
  • Loading branch information
courtneyholcomb authored May 24, 2024
1 parent 198b124 commit 1548e5d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion metricflow/plan_conversion/dataflow_to_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,9 @@ def visit_compute_metrics_node(self, node: ComputeMetricsNode) -> SqlDataSet:
column_name=expr, input_measure=input_measure, from_data_set_alias=from_data_set_alias
)
elif metric.type is MetricType.DERIVED:
assert metric.type_params.expr
assert (
metric.type_params.expr
), "Derived metrics are required to have an `expr` in their YAML definition."
metric_expr = SqlStringExpression(sql_expr=metric.type_params.expr)
elif metric.type == MetricType.CONVERSION:
conversion_type_params = metric.type_params.conversion_type_params
Expand Down

0 comments on commit 1548e5d

Please sign in to comment.