Skip to content

Commit

Permalink
feat: add coalesce to 0 on aggregations (#2)
Browse files Browse the repository at this point in the history
* feat: add coalesce to 0 on aggregations

* Update src/preset_cli/cli/superset/sync/dbt/metrics.py

Co-authored-by: CyprienAlle <83164456+CyprienAlle@users.noreply.github.com>

---------

Co-authored-by: Stefani <>
Co-authored-by: CyprienAlle <83164456+CyprienAlle@users.noreply.github.com>
  • Loading branch information
shrodingers and CyprienAlle authored Feb 28, 2023
1 parent 9faaba7 commit 666bc92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/preset_cli/cli/superset/sync/dbt/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_metric_expression(metric_name: str, metrics: Dict[str, MetricSchema]) ->

if calculation_method in simple_mappings:
function = simple_mappings[calculation_method]
return f"{function}({expression})"
return f"COALESCE({function}({expression}), 0)"

if calculation_method == "count_distinct":
return f"COUNT(DISTINCT {expression})"
Expand Down

0 comments on commit 666bc92

Please sign in to comment.