Skip to content

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

@wild-deer

Description

@wild-deer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions