-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Describe the bug
When this data is parsed the table "student
" is not returned by the parsed output.
DDL =
CREATE TABLE `department` (
`dept_name` varchar(20) NOT NULL,
`building` varchar(15) DEFAULT NULL,
`budget` decimal(12,2) DEFAULT NULL,
PRIMARY KEY (`dept_name`)
) ;
CREATE TABLE `student` (
`ID` varchar(5) NOT NULL,
`name` varchar(20) NOT NULL,
`dept_name` varchar(20) DEFAULT NULL,
`tot_cred` decimal(3,0) DEFAULT NULL,
`timestamp` datetime NOT NULL DEFAULT '2009-04-01 08:00:00',
PRIMARY KEY (`ID`),
KEY `dept_name` (`dept_name`),
CONSTRAINT `student_ibfk_1` FOREIGN KEY (`dept_name`) REFERENCES `department` (`dept_name`) ON DELETE SET NULL
) ;
To Reproduce
Steps to reproduce the behavior:
- Run this code
from simple_ddl_parser import DDLParser
results_from_text = DDLParser(DDL).run(output_mode="mysql")
print(results_from_text)
- Output on command line
[{'alter': {},
'checks': [],
'columns': [{'check': None,
'default': None,
'name': '`dept_name`',
'nullable': False,
'references': None,
'size': 20,
'type': 'varchar',
'unique': False},
{'check': None,
'default': 'NULL',
'name': '`building`',
'nullable': True,
'references': None,
'size': 15,
'type': 'varchar',
'unique': False},
{'check': None,
'default': 'NULL',
'name': '`budget`',
'nullable': True,
'references': None,
'size': (12, 2),
'type': 'decimal',
'unique': False}],
'index': [],
'partitioned_by': [],
'primary_key': ['`dept_name`'],
'schema': None,
'table_name': '`department`',
'tablespace': None}]
Expected behavior
List of Dicts returned should contain both student
and department
tables
Desktop (please complete the following information):
- OS: Windows 10 22H2 64 bit
- Python: Python 3.10.15 | packaged by Anaconda, Inc. | (main, Oct 3 2024, 07:22:19) [MSC v.1929 64 bit (AMD64)] on win32
Additional context
just trying to parse a simple mysql DDL
Metadata
Metadata
Assignees
Labels
No labels