Skip to content

Select statements are merged with a preceeding Jinja block #351

Closed Answered by tconbeer
gavlt asked this question in The sqlfmt Style
Discussion options

You must be logged in to vote

Thanks for starting this discussion. I agree that this formatting with config is not good. This pattern (long config block followed by select *) is actually quite common in snapshot files, so it's something I've seen before, but punted on fixing.

The reason we merge like this is actually to make aliasing look nice:

-- we want this:
{{
    something(
    ...
    )
}} as my_field,

-- not this:
{{
    something(
    ...
    )
}}
as my_field,

And to treat jinja brackets similar to parens in chains of operators:

    # we do this
    left join
         order_type
         on {{
             sales_funnel_text_slugify(
                 "sheetload_sales_funnel_targets_matrix_source.order_type"

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tconbeer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants