sqlparse icon indicating copy to clipboard operation
sqlparse copied to clipboard

SQL Formatting Thoughts

Open nick-hutchins opened this issue 5 years ago • 0 comments

I am a huge fan of this python module and I use it to format DDL extracted form the DB2 catalogue to format sql for corporate documentation. I know that formatting is often a personal style thing but here are some thoughts that I had an wondered if they would be considered for future release formatting options:

Currently when the SQL statement is formatted it wraps the open bracket onto the new line: CREATE OR REPLACE VIEW PVT_IDM_BDR_DATA.VW_UDV_ETL_FACT_FLAG AS (SELECT ROW_NUMBER() OVER() AS "ROW",......

would be great to have a formatting option that would render it as such instead CREATE OR REPLACE VIEW PVT_IDM_BDR_DATA.VW_UDV_ETL_FACT_FLAG AS( SELECT ROW_NUMBER() OVER() AS "ROW",......

Perhaps if there was a way to pass a list of keywords that would cause a new line + indent after them?

Then we could pass SELECT, CASE, WHEN, THEN, COALESCE etc into the module to force specific formatting results.

Thanks so much for your consideration of my feedback.

nick-hutchins avatar Aug 12 '21 01:08 nick-hutchins