sqlparse
sqlparse copied to clipboard
Improve rendering of DDL / CREATE TABLE
It is common practice (arguably) to put each column on a new line when defining a table.
Input / Expected output
CREATE TABLE settings (
id serial NOT NULL PRIMARY KEY,
name text,
value1 float,
value2 float,
value3 float,
value4 float,
value5 float,
value6 float,
value7 float,
value8 float,
value9 float
);
Result
A single long line
$ sqlformat --keywords upper --identifiers lower --reindent --wrap_after 120 --indent_columns create_stmt.sql
CREATE TABLE settings (id serial NOT NULL PRIMARY KEY, name text, value1 float, value2 float, value3 float, value4 float, value5 float, value6 float, value7 float, value8 float, value9 float);
Details
OS: macOS 11.0.1 Python: 3.7.8 Version: 0.4.1 and 0.4.2dev0 (63885dd5f1be3fe519fceb0a21f1f87fdc6aa973)
There seems to be some support for this, but it seems the settings (...) get tokenized as a Function and the whole is_dml_dll (itself a typo of is_dml_ddl?) is never True.
I am not sure what change needs to happen though.