Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for DDL ALTER statement #215

Closed
rmorais01 opened this issue Dec 15, 2023 · 4 comments
Closed

Support for DDL ALTER statement #215

rmorais01 opened this issue Dec 15, 2023 · 4 comments

Comments

@rmorais01
Copy link

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:)

@ghost
Copy link

ghost commented Jan 5, 2024

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..

@xnuinside
Copy link
Owner

@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

@xnuinside
Copy link
Owner

@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!

@ghost
Copy link

ghost commented Jan 8, 2024

@xnuinside thanks alot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants