sqlparse
sqlparse copied to clipboard
A non-validating SQL parser module for Python
You may pass a dict with a list of specific dialect keywords to consider. Default behavior is to consider *all* supported dialects (oracle, plpgsql, hql). keywords.keywords_map(*dialects) helper is provided to...
``` foo = """ select c1, c2, c3 from t1 left join t2 on t1.c1 = t2.c2 , t3 where t1.c1 = t3.c3 """ for x in list(sqlparse.parse(foo)[0]): if x.is_whitespace:...
on https://sqlparse.readthedocs.io/en/latest/api/ I can't find an option to insert a new line after some keywords like SELECT, FROM, LEFT JOIN, ON, ... Is it possible to implement this option or...
In a SQL query we have a keyword as identifier for a CTE: ```sql WITH data AS ( SELECT * FROM table WHERE id < 100 ) SELECT * FROM...
I think this is a bug. (but please verify) This is my same SQL query ```sql CREATE TABLE foo ( id integer primary key, title NUMERIC(38,6) not null, description text);...
Hello. I tried to use yoyo-migrations in my project, however, when creating a schema with procedures using REPEAT, I received errors. Learning the sources led me to the sqlparse library....
sql = "SELECT NAME, ROW_NUMBER() OVER (PARTITION BY T.NAME ORDER BY T.NAME ) L_INSEQ FROM TEST T" i got parsed: |- 0 DML 'SELECT' |- 1 Whitespace ' ' |-...
hi ~ If provide an SQL parameter, how to get the SQL tablename? thanks ~
``` sqlparse.format( "SELECT extract(HOUR from from_unixtime(hour_ts) AT TIME ZONE 'America/Los_Angeles') from table", reindent=True) ``` removes space between `from` and `from_unixtime(hour_ts` in the 0.3.1 version, works fine in 0.3.0 Related superset...
Hi, I found this tool is not friendly support to Chinese currently. Here is one example "SELECT T1.运动员id FROM FIFA金球奖 AS T1 WHERE T1.运动员 == '运动员' ORDER BY T1.id DESC...