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

Column comments containing '' don't parse. #208

Closed
PBalsdon opened this issue Oct 31, 2023 · 2 comments
Closed

Column comments containing '' don't parse. #208

PBalsdon opened this issue Oct 31, 2023 · 2 comments
Assignees

Comments

@PBalsdon
Copy link
Contributor

PBalsdon commented Oct 31, 2023

Describe the bug
Parsing fails where column comments contain a pair of single quotes, ''. This is used for column comments in snowflake to allow a single ' to appear in the definition.

To Reproduce
Parse the statement:

CREATE TABLE table (column_1 int comment 'This comment isn''t right')

Expected behavior
A standard parsing output:
Expected:

[{
  'alter': {},
  'checks': [],
  'clone': None,
  'columns': [{'check': None,
               'comment': "'This comment isn't right'",
               'default': None,
               'name': 'column_1',
               'nullable': True,
               'references': None,
               'size': None,
               'type': 'int',
               'unique': False}],
  'index': [],
  'partitioned_by': [],
  'primary_key': [],
  'primary_key_enforced': None,
  'schema': None,
  'table_name': 'table',
  'tablespace': None
}]

Screenshots
Instead, we get the output []

Version
Latest

Additional context
I know this is snowflake syntax. Perhaps it is also true for other dialects, I'm not sure.

@PBalsdon PBalsdon changed the title Column comments containging '' don't parse. Column comments containing '' don't parse. Oct 31, 2023
@xnuinside xnuinside self-assigned this Nov 5, 2023
@xnuinside
Copy link
Owner

@PBalsdon hi! Thanks for creating the issue, I added support for this #210 & test. It will be released in version 0.31.1 together with your PR.

@xnuinside
Copy link
Owner

@PBalsdon 0.31.1 was released https://pypi.org/project/simple-ddl-parser/

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