sqlparse
sqlparse copied to clipboard
Keywords are uppercased even when they are used as identifiers
It seems that sqlparse.format considers words like date and segment as SQL identifiers, and so when these words are used as identifiers with keyword_case=True, sqlparse will automatically uppercase them.
It would be ideal if keywords would be only treated as keywords when they are used as keywords instead of naively uppercasing segment anywhere it is used. This can cause confusion to users when their column names are uppercased unexpectedly.
fwiw this is affecting us too. For example:
SELECT 1 AS count;
turns into:
SELECT 1 AS COUNT;
and
CREATE TABLE foo (count INT);
turns into:
CREATE TABLE foo (COUNT INT);