sqlparse icon indicating copy to clipboard operation
sqlparse copied to clipboard

A non-validating SQL parser module for Python

Results 194 sqlparse issues
Sort by recently updated
recently updated
newest added

#376 I add three regular expression to match Chinese, Japanese, Korean words . Now it can tokenize sql correctly like 'select T2.名称 , T2.南北区域 from 民风彪悍十大城市 as T1 join 省份...

Needs Feedback

The split does not work properly for the below Oracle Stored procedure CREATE OR REPLACE EDITIONABLE PROCEDURE "OWB_ADMIN"."AZBJ_RI_LIMIT_PROC" AS week_date_first DATE := TRUNC (azbj_pme_api.opus_date - 7); week_date_last DATE := TRUNC...

Bug

I'm aware of at least 2 sql dialects that have `->` ("arrow") operators. presto/athena use them as part of lambda expressions (https://prestodb.io/docs/current/functions/lambda.html) and postgres uses them to get things out...

when column type is decimal(30,8) like: SQL = """CREATE TABLE foo ( id decimal(30,8) primary key, title varchar(200) not null, description text);""" result is : NAME: id DEFINITION: decimal 30...

In https://github.com/dbt-labs/dbt-core we use sqlparse to merge ctes at a particular place in our code. Multiple threads are started at the same time, and because the Lexer default instance is...

Bug

When I use the API how do I specify in which language I want to have the output (SQL, PHP, Phyton)? In the interface there is an option dedicated to...

## Pivot examples: [From here.](http://www.dba-oracle.com/t_pivot_examples.htm) Syntax diagrams: https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_10002.htm#CHDCEJJE Input: ``` WITH T AS ( SELECT DEPTNO FROM EMP ) SELECT * FROM T PIVOT ( COUNT(*) FOR (DEPTNO) IN (10,20,30,40)...

Enhancement
Parser

The issue: >>> q1 = '(select 1 as "a") UNION (select 2 as "a")' >>> q2 = 'select 1 as "a" UNION select 2 as "a"' >>> sqlparse.parse(q1)[0].get_type() 'UNKNOWN' >>>...

I am trying to parse an SQL query: ``` do $$ declare content_count int = 10; begin /*comment*/ select 1; end; $$ ``` sqlformat.org parse and highlight it correctly: ![image](https://github.com/andialbrecht/sqlparse/assets/12968820/f9a04bf9-88c2-42b7-abc3-9439df973c9d)...

Could you please help me to configure sqlparse to get source table, target table, joins and other relevant dependencies from this query? as you can see there are some ctes...