xnuinside/simple-ddl-parser

Support for DDL ALTER statement

rmorais01 opened this issue · 4 comments

Is your feature request related to a problem? Please describe.
A very useful addition to the simple-ddl-parser would be the ability to parse and process the SQL ALTER command for ADD/DROP/RENAME column, MODIFY DATATYPE and MODIFY CONSTRAINT. Currently there is a very limited support for only processing ALTER statements with FOREIGN key.

Describe the solution you'd like
The solution must be able to parse the SQL ALTER command and apply the alterations to the Table created using the CREATE command in the same file.

Describe alternatives you've considered
NA

Additional context
Here are some examples for the ALTER command

ALTER TABLE - ADD Column
ALTER TABLE table_name ADD column_name datatype;

ALTER TABLE - DROP COLUMN
ALTER TABLE table_name DROP COLUMN column_name;

ALTER TABLE - RENAME COLUMN
ALTER TABLE table_name RENAME COLUMN old_name to new_name;

ALTER TABLE - ALTER/MODIFY DATATYPE
ALTER TABLE table_name ALTER COLUMN column_name datatype; (SQL Server)
ALTER TABLE table_name MODIFY COLUMN column_name datatype; (My SQL / Oracle (prior version 10G)
ALTER TABLE table_name MODIFY column_name datatype; (Oracle 10G and later:)

Are we going to support DDL alter soon ?
It would be good, if we can add support for these alters. requesting you to please work on this soon..

@rmorais01 thanks for opening this issue & explicit examples, required changes will be in this PR #225
@abhishek0102 I will finish it today and release in version 0.32.0

@abhishek0102 @rmorais01 all changes released in version 0.32.0, tests added here - https://github.com/xnuinside/simple-ddl-parser/blob/main/tests/test_alter_statements.py#L1778. If will be needed something else - feel free to open new issues & thanks one more time!

@xnuinside thanks alot.