Nicely formats a SQL file for you.
Warning: will probably wreak havoc if run on anything that isn’t a pure SQL file. That is to say, don’t pass it a Python file with some SQL mixed in. SQL files only.
Prerequisites: sqlformat executable which comes from the
sqlparse Python library.
Install it with pip3 install sqlparse
USAGE: format_sql path/to/sql_file.sql
replaces the content of the file
with formatted SQL
Requires sqlformat command
see https://github.com/andialbrecht/sqlparse
Metadata:
Tags: