simple-ddl-parser icon indicating copy to clipboard operation
simple-ddl-parser copied to clipboard

Support Parse MYSQL DDL with 'COLLATE' option

Open bumhwan opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

Our database tables are set up with collate options, and due to these collate options, we always have to remove them before using simple-ddl-parser. This additional preprocessing step is frustrating and error-prone.

Describe the solution you'd like

There are two potential solutions:

Parse the COLLATE keyword along with other options. If there are unsupported options, instead of failing the entire parsing process, return the successfully parsed keywords and ignore or flag the unsupported ones.

Describe alternatives you've considered

Currently, we are solving this issue by removing the COLLATE clause before feeding the DDL into simple-ddl-parser. However, we would like to eliminate this preprocessing step.

Additional context

Here is an example of a DDL statement that causes issues:

CREATE TABLE example_table (
    id INT PRIMARY KEY,
    name VARCHAR(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Library Version: 1.5.1 Python Version: 3.10 Operating System: macOS

Updating the parser to handle these MySQL-specific options would greatly improve usability. I appreciate the work put into this library and hope this issue can be resolved soon.

bumhwan avatar Jul 01 '24 03:07 bumhwan