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

DDLParser Issue: Failure to Recognize Database Name with Conditional IF NOT EXISTS Clause #293

Open
wild-deer opened this issue Jan 13, 2025 · 0 comments

Comments

@wild-deer
Copy link

Sure, here is the detailed description of the issue for your problem statement:

Issue Description:

When using the DDLParser in Python with the provided code snippet, the parser is unable to correctly identify the database name when the CREATE DATABASE statement is followed by a conditional IF NOT EXISTS clause.

Steps to Reproduce:

  1. Execute the following code snippet:
ddl = """

CREATE DATABASE IF NOT EXISTS `employees`;
"""
result = DDLParser(ddl).run(output_mode="mysql")
print(result)
  1. The output returned is an empty list: [].

  2. Execute the following code snippet:

ddl = """

CREATE DATABASE  `employees`;
"""
result = DDLParser(ddl).run(output_mode="mysql")
print(result)
  1. The output returned is [{'database_name': 'employees'}] which correctly identifies the database name.

Expected Behavior:

The DDLParser should be able to correctly identify the database name even when the CREATE DATABASE statement is followed by a conditional IF NOT EXISTS clause.

Actual Behavior:

The parser fails to recognize the database name when the CREATE DATABASE statement includes the IF NOT EXISTS clause.

Additional Information:

The issue seems to be related to how the parser handles conditional clauses before the database name in the CREATE DATABASE statement. It would be helpful to enhance the parser to properly handle such scenarios for improved functionality.

Please let me know if you need any further information or clarification on this issue.

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

1 participant