From d418fd0a27244a6620d811cee006b4de4ac03add Mon Sep 17 00:00:00 2001 From: Chris Stevens Date: Fri, 14 Jun 2024 15:31:56 -0400 Subject: [PATCH] Add redshift specific coefficient return function --- macros/linear_regression/utils.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/macros/linear_regression/utils.sql b/macros/linear_regression/utils.sql index d5cbaab..235cdd4 100644 --- a/macros/linear_regression/utils.sql +++ b/macros/linear_regression/utils.sql @@ -177,6 +177,14 @@ gb{{ loop.index }} as {{ gb }}, {% endif %} {% endmacro %} +{% macro redshift___maybe_round(x, round_) %} + {% if round_ is not none %} + {{ return('round(' ~ x ~ ', ' ~ round_ ~ ')') }} + {% else %} + {{ return(x) }} + {% endif %} +{% endmacro %} + {# Alias and write group by columns in a standard way. #} {% macro _gb_cols(group_by, trailing_comma=False, prefix=None) -%} {%- if group_by %}