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

MySQL parsed data missing tables #290

Open
DevashishX opened this issue Nov 29, 2024 · 1 comment
Open

MySQL parsed data missing tables #290

DevashishX opened this issue Nov 29, 2024 · 1 comment

Comments

@DevashishX
Copy link

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:

  1. Run this code
from simple_ddl_parser import DDLParser
results_from_text = DDLParser(DDL).run(output_mode="mysql")
print(results_from_text)
  1. 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

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
@DevashishX and others