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
185
stars
42
forks
source link
Fail to parse Postgres CREATE TABLE statement with GENERATED ALWAYS AS IDENTITY(INCREMENT BY 1...) #257
Error 1: simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(BY,'BY',1,105)
if delete the word 'BY' after 'INCREMENT'
Error 2: simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(NO,'NO',1,154)
Expected behavior
parsed output
Desktop (please complete the following information):
OS: [Windows10]
Python 3.11.5
simple_ddl_parser 1.3.0
Additional context
log_file='parser19052.log' log file was created but was empty and never was populated.
Hello.
To Reproduce ddl = """CREATE TABLE IF NOT EXISTS public.generator_id ( hall_id int4 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START 1 CACHE 1 NO CYCLE) NOT NULL, hall_name varchar(50) NOT NULL, CONSTRAINT hall_pkey PRIMARY KEY (hall_id)); ""
parse_results = DDLParser(ddl, silent=False, log_file='parser19052.log', log_level=logging.DEBUG).run()
Error 1: simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(BY,'BY',1,105) if delete the word 'BY' after 'INCREMENT' Error 2: simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(NO,'NO',1,154)
Expected behavior parsed output
Desktop (please complete the following information):
Additional context log_file='parser19052.log' log file was created but was empty and never was populated.
Thank You!