Any table name that includes the substring select in it disables the subsequent formatting (or at least line breaks and indenting) of the subsequent statements (e.g. JOIN, ORDER BY, etc).
To Reproduce
Example 1: using select in the name of the FROM table leads to formatting all the subsequent statements without line breaks:
sql_formatter.core.format_sql("""
SELECT var
FROM table_selection as a
LEFT JOIN table2 as b ON a.id = b.id
LEFT JOIN table3 as c ON a.id = c.id
ORDER BY 1
""")
Out[55]: 'SELECT var\nFROM table_selection as a LEFT JOIN table2 as b ON a.id = b.id LEFT JOIN table3 as c ON a.id = c.id ORDER BY 1'
Example 2: using select in the name of the JOIN table leads to formatting all the subsequent statements without line breaks:
sql_formatter.core.format_sql("""
SELECT var
FROM table1 as a
LEFT JOIN table_selection as b ON a.id = b.id
LEFT JOIN table3 as c ON a.id = c.id
ORDER BY 1
""")
Out[53]: 'SELECT var\nFROM table1 as a\n LEFT JOIN table_selection as b ON a.id = b.id LEFT JOIN table3 as c ON a.id = c.id ORDER BY 1'
Expected behavior
Line breaks before keywords, as in:
sql_formatter.core.format_sql("""
SELECT var
FROM table1 as a
LEFT JOIN table2 as b ON a.id = b.id
LEFT JOIN table3 as c ON a.id = c.id
ORDER BY 1
""")
Out[54]: 'SELECT var\nFROM table1 as a\n LEFT JOIN table2 as b\n ON a.id = b.id\n LEFT JOIN table3 as c\n ON a.id = c.id\nORDER BY 1'
Describe the bug
Any table name that includes the substring
select
in it disables the subsequent formatting (or at least line breaks and indenting) of the subsequent statements (e.g.JOIN
,ORDER BY
, etc).To Reproduce
Example 1: using
select
in the name of theFROM
table leads to formatting all the subsequent statements without line breaks:Example 2: using
select
in the name of theJOIN
table leads to formatting all the subsequent statements without line breaks:Expected behavior
Line breaks before keywords, as in:
Screenshots
NA