sql case functions and colons put in line breaks

Hi All:

When I use upper(), lower() or initcap() functions, the output SQL always has line breaks if I have a jinja expression as the input. For instance, lower({{ columnName }}) compiles as:

            lower(
            'ABC123'
        )

literally typing in lower('ABC123') formats without any line breaks.

Is this a setting I can modify? It only does it for the 3 string casing functions. To this point I have not seen this happen with any other SQL functions.

I am, however, seeing the same behavior if there is a full colon in the output.
{{ ColumnName }} : {{ SomeOtherVar }} formats as:

            ActualColumnName :
                        AcutalOtherVarValue

My goal is to format the outputs as an entry to a Python dictionary. So I really need the output to be:
ColumnName : lower(ColumnName)

As an FYI, this is the format required by the dbt package dbtvault (A.K.A AutomateDV) for a derived column.

Many thanks for any assistance!
Simon

It’s stubborn, but the replace filter can remove all the line feeds:

{%- set lowerstring -%}
    lower({{ space_cleanup(input_column, spacing) }})
{%- endset -%}

{{ lowerstring | replace('\n','') }}

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.