3 ms·
sqlparse comes to mind - https://github.com/andialbrecht/sqlparse https://github.com/andialbrecht/sqlparse I know the maintainer, they also run a service at ht
by the_ez 10y ago
sqlparse comes to mind - https://github.com/andialbrecht/sqlparse https://github.com/andialbrecht/sqlparse
I know the maintainer, they also run a service at https://sqlformat.org/ https://sqlformat.org/
You can try it on the command line e.g. on Fedora:
$ sudo dnf install python3-sqlparse
$ echo "select c1, c2, c3 from table1 join table2 t2 on t1.col2 = t2.col1 where 1=2 order by col2 limit 100" | sqlformat -k upper -i lower -sa -
SELECT c1,
c2,
c3
FROM table1
JOIN table2 t2
ON t1.col2 = t2.col1
WHERE 1 = 2
ORDER BY col2
LIMIT 100