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.
MIT License
179 stars 40 forks source link

CREATE SCHEMA IF NOT EXISTS STATEMENT with COMMENT #281

Open dmaresma opened 1 month ago

dmaresma commented 1 month ago

Describe the bug the following SQL statement fail : CREATE SCHEMA IF NOT EXISTS TESTBLABLA COMMENT='my blabla comment';

`from simple_ddl_parser import DDLParser local_ddl = """CREATE SCHEMA IF NOT EXISTS TESTBLABLA COMMENT='my blabla comment';""" schema_if_not_exists = DDLParser(local_ddl).run(output_mode="snowflake") expected = [{'if_not_exists': True, 'schema_name': 'TESTBLABLA', 'comment': "'my blabla comment'"}]

schema_if_not_exists

assert(schema_if_not_exists == expected)`

The schema / schema_name is not detected.

dmaresma commented 4 weeks ago

if I remove lines | create_schema id id id | create_schema id id STRING from p_create_schema in sql.py everything is back to normal, all test in success (supposed to mean no regressions)

xnuinside commented 4 weeks ago

@dmaresma we can remove it if all tests are green, maybe some artefact from the past. I always adding tests for statements, so if tests are green - feel free to delete it, or I can do it on weekends