Puoi utilizzare il pacchetto sqlparse e sqlparse.format(sql, reindent=True, keyword_case='upper') dovresti fare quello che vuoi?
Puoi utilizzare il pacchetto sqlparse e sqlparse.format(sql, reindent=True, keyword_case='upper') dovresti fare quello che vuoi?