-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Is your feature request related to a problem? Please describe.
we always add/modify/drop multiple columns . but simple-ddl-parse output alter is empty:
def test_alter_table_add_two_column():
ddl = """
CREATE TABLE material_attachments (
material_id int NOT NULL,
attachment_id int NOT NULL
);
ALTER TABLE material_attachments ADD column_name1 datatype,ADD column_name2 datatype;
"""
result = DDLParser(ddl).run(group_by_type=True)
print(json.dumps(result, indent=4))
the wrong output as following (output alter is {}):
test_ddl_parser.py::test_alter_table_add_two_column PASSED [100%]{
"tables": [
{
"table_name": "material_attachments",
"schema": null,
"primary_key": [],
"columns": [
{
"name": "material_id",
"type": "int",
"size": null,
"references": null,
"unique": false,
"nullable": false,
"default": null,
"check": null
},
{
"name": "attachment_id",
"type": "int",
"size": null,
"references": null,
"unique": false,
"nullable": false,
"default": null,
"check": null
}
],
"alter": {},
"checks": [],
"index": [],
"partitioned_by": [],
"tablespace": null
}
],
"types": [],
"sequences": [],
"domains": [],
"schemas": [],
"ddl_properties": []
}
Describe the solution you'd like
output alter is not empty
Describe alternatives you've considered
Additional context
the same problem test case(output alter is {}):
def test_alter_table_drop():
ddl = """
CREATE TABLE material_attachments (
material_id int NOT NULL,
attachment_id int NOT NULL
);
ALTER TABLE material_attachments DROP COLUMN attachment_id;
"""
result = DDLParser(ddl).run(group_by_type=True)
print(json.dumps(result, indent=4))
def test_alter_table_modify_2_column():
ddl = """
CREATE TABLE material_attachments (
material_id int NOT NULL,
attachment_id int NOT NULL
);
ALTER TABLE material_attachments MODIFY COLUMN material_id integer,MODIFY COLUMN attachment_id integer;
"""
result = DDLParser(ddl).run(group_by_type=True)
print(json.dumps(result, indent=4))
and add coumn not supported(output alter is {}):
def test_alter_table_add_column():
ddl = """
CREATE TABLE material_attachments (
material_id int NOT NULL,
attachment_id int NOT NULL
);
ALTER TABLE material_attachments ADD COLUMN column_name datatype;
"""
result = DDLParser(ddl).run(group_by_type=True)
print(json.dumps(result, indent=4))
Metadata
Metadata
Assignees
Labels
No labels