xnuinside / simple-ddl-parser

Simple DDL Parser to parse SQL (HQL, TSQL, AWS Redshift, BigQuery, Snowflake and other dialects) ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc. & table properties, types, domains, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to parse if DDL lacks semicolon or GO between statements.

n2ygk opened this issue · comments

Describe the bug
Fails to parse some ddl if there's no semicolon or GO in between statements.

This silently fails to produce output:

DROP TABLE IF EXISTS sample
CREATE TABLE sample
(
     sid BIGINT NOT NULL,
     foo CHAR(5),
     CONSTRAINT sample_key PRIMARY KEY NONCLUSTERED (sid)
)

While this succeeds (adds a semicolon).

DROP TABLE IF EXISTS sample;
CREATE TABLE sample
(
     sid BIGINT NOT NULL,
     foo CHAR(5),
     CONSTRAINT sample_key PRIMARY KEY NONCLUSTERED (sid)
)

To Reproduce

sdp sample_ddl.sql

Expected behavior
Parser output or an error message or non-zero exit code.

hi @n2ygk to be honest )) before your issue I leave all the time with thoughts that between different statements you need separator or you will get syntax error )

@n2ygk I will add support of this in next release

@n2ygk fixes for both issues were released in version 0.22.0 - https://pypistats.org/packages/simple-ddl-parser . If you will find anything more - please feel free to open new issue and thank you one more time!