Skip to content

Commit

Permalink
Fixing test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitor-Avila committed Apr 5, 2024
1 parent 86fae26 commit 9fe3177
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/preset_cli/cli/superset/sync/dbt/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ def get_metric_expression(metric_name: str, metrics: Dict[str, MetricSchema]) ->
expression = sqlglot.parse_one(sql, dialect=metric["dialect"])
except ParseError:
for parent_metric in metric["depends_on"]:
metric_name = parent_metric.split(".")[-1]
pattern = r"\b" + re.escape(metric_name) + r"\b"
parent_metric_syntax = get_metric_expression(metric_name, metrics)
parent_metric_name = parent_metric.split(".")[-1]
pattern = r"\b" + re.escape(parent_metric_name) + r"\b"
parent_metric_syntax = get_metric_expression(parent_metric_name, metrics)
sql = re.sub(pattern, parent_metric_syntax, sql)
return sql
return sql

tokens = expression.find_all(exp.Column)

Expand Down

0 comments on commit 9fe3177

Please sign in to comment.