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
I have been writing SQL for a number of years and recognize the fact that it would have been better to use a LEFT JOIN, however often in the use case that I provided the result would be a sum or an average that would have required a grouping or a partition by that the original coder wasn't in favor of for some reason so they did it as a sub-query within the list of columns to be pulled into the report.
The whole reason for carefully formatting the code for me is the fact that I'm using it to parse out the tables and columns that are used within the query so that I can create a list for further work within python. When formatted properly I'm able to find the table aliases much faster.
Describe the bug
When formatting a query that has a query within the column list
To Reproduce
python
.from sql_formatter.core import format_sql
print( format_sql( "SELECT Column1, Column2, (SELECT column3 from SubTable) Column 4 FROM TABLE" ) )
output:
SELECT_column1,
_______column2,
_______(SELECT_column3
_FROM___subtable)_column4
FROM___table
Expected behavior
SELECT
_____column1,
_____column2,
_____(
__________SELECT
_______________column3
__________FROM__subtable
_____)_column4
FROM table
Screenshots
Sorry for "_" but the 'code' in the editor was dropping formatting.
The text was updated successfully, but these errors were encountered: