format-sql
format-sql copied to clipboard
Makes your SQL readable.
I want to format this sql query but it's showing runtime error => [https://github.com/yugyesh/song_play_analysis/blob/dev/sql_queries.py](url)
This package is part of the pip repository manager for python, fine, but how do you use it from a python script? There is only information on how to run...
See example, where did the `::` go? ```python from format_sql import format_sql print('\n'.join(format_sql('SELECT cast::jsonb'))) >>> SELECT >>> cast jsonb ```
Currently these are being unwrapped, so `FROM {schema_name}.table_name` becomes `schema_name table_name`.
See this example snippet: ```python >>> format_sql.format_sql('''select a.a from aaa a where ((a.b+1) = 2);''') Traceback (most recent call last): File "", line 1, in File "/home/koerner/miniconda3/envs/tests-sql/lib/python3.6/site-packages/format_sql/shortcuts.py", line 20, in...
I run the following command ``` format-sql a_sql_file.sql ``` but got the following error ``` Traceback (most recent call last): File "/usr/local/bin/format-sql", line 11, in sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/format_sql/main.py", line 83,...
Prior to this change, if the input file contained invalid SQL it would be overwritten with an empty file. This change lets the exception propagate so that the file is...
``` File "/usr/local/bin/format-sql", line 11, in sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/format_sql/main.py", line 83, in main _write_back(filename, lines, args.dry_run) File "/usr/local/lib/python2.7/dist-packages/format_sql/main.py", line 148, in _write_back f.write(lines) TypeError: expected a character buffer object ```...
The parser will fail to parse a query like `select "id" from table`. This is DBMS specific, so this may actually be a parse error for other databases, but its...
Would it possible to have a switch to have the example in the README parsed like this ``` SQL SELECT country, product, SUM(profit) FROM sales LEFT JOIN x ON --...