You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by gavlt January 9, 2023
A small select statement will be "optimistically" (or maybe "aggressively") merged onto closing Jinja brackets.
My use case here are dbt models against a Redshift database when we want to select a whole table from one schema into another and/or apply a (potentially new) partitioning which is managed by a dbt config block.
The resulting output feels a little compact to me. While sqlfmt doesn't necessarily share the complete Black philosophy, this style feels counter to readability and minimising git diffs (i.e. if in future I want to drop the config block it will impact the select statement also).
In #249 (comment) regarding preserving blank lines (like black) you made the following comment about this style/behaviour/request being popular, which I haven't been able to find any further reference to:
In other words, we'll allow 2 blank lines in between statements (e.g., between a {{ config }} block and select, which seems popular)
Expected behavior
A blank line is preserved, or inserted, or the closing brackets are retained on the preceding line?
Additional detail
I see this behaviour is explained in the LineMerger:
# we can merge lines containing multiline jinja nodes iff:# 1. the multiline node is on the first line (allow_multiline# is initialized to True)# 2. the multiline node is on the second line and follows a# standalone operator
Is this change in style planned and/or on the roadmap or in flight, perhaps as part of #249 (which is intended for v0.15?)
The text was updated successfully, but these errors were encountered:
Let's fix this. Only merge multi-line jinja with operators (incl. as, comma, etc.).
Discussed in #351
Originally posted by gavlt January 9, 2023
A small select statement will be "optimistically" (or maybe "aggressively") merged onto closing Jinja brackets.
My use case here are dbt models against a Redshift database when we want to select a whole table from one schema into another and/or apply a (potentially new) partitioning which is managed by a dbt config block.
The resulting output feels a little compact to me. While sqlfmt doesn't necessarily share the complete Black philosophy, this style feels counter to readability and minimising git diffs (i.e. if in future I want to drop the config block it will impact the select statement also).
In #249 (comment) regarding preserving blank lines (like black) you made the following comment about this style/behaviour/request being popular, which I haven't been able to find any further reference to:
To Reproduce
Actual behavior
Expected behavior
A blank line is preserved, or inserted, or the closing brackets are retained on the preceding line?
Additional detail
I see this behaviour is explained in the LineMerger:
Is this change in style planned and/or on the roadmap or in flight, perhaps as part of #249 (which is intended for v0.15?)
The text was updated successfully, but these errors were encountered: