Fix metric expression extraction: use 'code' field
OpenMetadata stores SQL in metricExpression.code, not .expression. This caused all metric expressions to export as empty strings.
This commit is contained in:
parent
908d1f2247
commit
e63c8747b5
1 changed files with 2 additions and 1 deletions
|
|
@ -102,7 +102,8 @@ def extract_expression(raw_metric: Dict[str, Any]) -> str:
|
|||
"""
|
||||
metric_expr = raw_metric.get("metricExpression", {})
|
||||
if isinstance(metric_expr, dict):
|
||||
return metric_expr.get("expression", "") or ""
|
||||
# OpenMetadata uses "code" field for the SQL expression
|
||||
return metric_expr.get("code", "") or metric_expr.get("expression", "") or ""
|
||||
if isinstance(metric_expr, str):
|
||||
return metric_expr
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue