andialbrecht / sqlparse

A non-validating SQL parser module for Python
BSD 3-Clause "New" or "Revised" License
3.76k stars 700 forks source link

Several issues with DDL parsing - most annoying is table name identified as a function #610

Open rvatne opened 3 years ago

rvatne commented 3 years ago

'create table A(....' will identify A as a function 'CREATE table A(....' will not - aka is OK 'create table "A"(....' is also OK

varchar2 (2) will identify varchar2 as Token.Name.Builtin while varchar2(2) will identify varchar2 as Token.Name

I know the original intention with this library probably was not parsing DDL's, but I bet there is more persons trying to parse DDL's than SQL (queries)

xnuinside commented 3 years ago

@rvatne if it is a still actual for you - I created separate library for DDL parsing because of several issues in sqlparse https://github.com/xnuinside/simple-ddl-parser

jimfulton commented 3 years ago

I got bitten by this today. I had to capitalize both "create" and "table". It's really surprising to me that parsing is so affected by case.