You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
DDLParser fail to parse Mysql ddl starting from "DEFAULT CHARSET = utf8mb4", and gives empty result.
However the parser is working when this "DEFAULT CHARSET = utf8mb4" expression is removed
To Reproduce
Steps to reproduce the behavior:
Python sys.version = '3.9.12 (main, Apr 5 2022, 01:53:17) \n[Clang 12.0.0 ]'
`
import simple_ddl_parser as sdp
print("this is not working")
mysql_create_sql0 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '导入元数据管理';
"""
print(sdp.DDLParser(mysql_create_sql0).run(output_mode="mysql"))
print("this is not working")
mysql_create_sql1 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '导入元数据管理';
"""
print(sdp.DDLParser(mysql_create_sql1).run())
print("this is not working")
mysql_create_sql2 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4;
"""
print(sdp.DDLParser(mysql_create_sql2).run())
print("this is working")
mysql_create_sql3 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB COMMENT = '导入元数据管理';
"""
print(sdp.DDLParser(mysql_create_sql3).run())
`
Expected behavior
This Default Expr should be identified or ignored if not recognzied
Screenshots
Desktop (please complete the following information):
Additional context
There are some yacc logs generating at the first time, however it leads to a crash.
After restarting the kernel , the parser returns empty list immediately
The text was updated successfully, but these errors were encountered:
Describe the bug
DDLParser fail to parse Mysql ddl starting from "DEFAULT CHARSET = utf8mb4", and gives empty result.
However the parser is working when this "DEFAULT CHARSET = utf8mb4" expression is removed
To Reproduce
Steps to reproduce the behavior:
Python sys.version = '3.9.12 (main, Apr 5 2022, 01:53:17) \n[Clang 12.0.0 ]'
`
import simple_ddl_parser as sdp
print("this is not working")
mysql_create_sql0 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '导入元数据管理';
"""
print(sdp.DDLParser(mysql_create_sql0).run(output_mode="mysql"))
print("this is not working")
mysql_create_sql1 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COMMENT = '导入元数据管理';
"""
print(sdp.DDLParser(mysql_create_sql1).run())
print("this is not working")
mysql_create_sql2 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4;
"""
print(sdp.DDLParser(mysql_create_sql2).run())
print("this is working")
mysql_create_sql3 = """CREATE TABLE t_table_records (
id VARCHAR (255) NOT NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
creator VARCHAR (32) DEFAULT 'sys' NOT NULL,
current_rows BIGINT,
edit_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
editor VARCHAR (32) DEFAULT 'sys' NOT NULL,
managed_database_database VARCHAR (255) NOT NULL,
managed_database_schema VARCHAR (255),
managed_database_table VARCHAR (255) NOT NULL,
source_database_database VARCHAR (255) NOT NULL,
source_database_jdbc VARCHAR (255) NOT NULL,
source_database_schema VARCHAR (255),
source_database_table VARCHAR (255) NOT NULL,
source_database_type VARCHAR (255) NOT NULL,
source_rows BIGINT,
PRIMARY KEY (id)
) ENGINE = INNODB COMMENT = '导入元数据管理';
"""
print(sdp.DDLParser(mysql_create_sql3).run())
`
Expected behavior
This Default Expr should be identified or ignored if not recognzied
Screenshots
Desktop (please complete the following information):
Additional context
There are some yacc logs generating at the first time, however it leads to a crash.
After restarting the kernel , the parser returns empty list immediately
The text was updated successfully, but these errors were encountered: