The common package for parsing SQL in Python is sqlparse:
pip3 install --user sqlparse
I wish to parse a list of create table statements, the library creates new lines sometimes but with wrong indentation:
import sqlparse;
print(sqlparse.format("create table (id int,foo text, bar float)", reindent=True, keyword_case="upper"));
The indentation is more and more for every subsequent line, this makes the SQL text look broken. How to tell sqlparse to indent properly? Tried reindent_aligned=True too but not working.