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
175 stars 40 forks source link

MySQL - UNIQUE in Create Table with constraint name #262

Open hubg398 opened 1 month ago

hubg398 commented 1 month ago
parse_results = DDLParser("""
CREATE TABLE `api_tokenbucket` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `value` VARCHAR(80),
  UNIQUE `constraint_name`(
    `value`
  )
);
"""
, silent=False).run(output_mode='mysql')

The above fails to parse. It works if we remove

'constraint_name'

Cheers