microsoft / dbt-fabric

MIT License
79 stars 28 forks source link

fabric__concat macro does not support 1 column #157

Closed simon-sandell-swedavia-se closed 7 months ago

simon-sandell-swedavia-se commented 7 months ago

The defaultconcat macro supports calling with 1..n columns, while the fabricconcat macro will fail with 1 column. This inconsistent behaviour can be avoided with something like this:

{% macro fabric__concat(fields) -%}
    {%- if fields|length < 2 -%}
        {{ fields[0] }}
    {%- else -%}
        concat({{ fields|join(', ') }})
    {%- endif -%}
{%- endmacro %}