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

CHECK with IN clause does not parse #121

Closed
tomc-goodrx opened this issue Mar 12, 2022 · 2 comments
Closed

CHECK with IN clause does not parse #121

tomc-goodrx opened this issue Mar 12, 2022 · 2 comments

Comments

@tomc-goodrx
Copy link

Using the IN keyword in a CHECK causes parsing to fail. For example:

`col_name` varchar(5) CHECK( `col_name` = 'year' OR `col_name` = 'month' ),

Works but with an IN statement doesn't:

`col_name` varchar(5) CHECK( `col_name` IN ('year', 'month') ),

With silent=False we get an error like:

  File ".../lib/python3.9/site-packages/simple_ddl_parser/ddl_parser.py", line 199, in p_error
    raise DDLParserError(f"Unknown statement at {p}")
simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(STRING,"'year'",1,544)

Using OR statements becomes unwieldy when there are more than a handful of options in the enum so it would be nice to support this. Thanks.

@xnuinside
Copy link
Owner

xnuinside commented Mar 12, 2022

@tomc-goodrx thanks for reporting, I'm working now on new version - will add support for IN statement in CHECK.

@xnuinside
Copy link
Owner

@tomc-goodrx :( it was hard & long month, sorry for the delay, just released v 0.26.0 that contains fix https://pypi.org/project/simple-ddl-parser/ and test - https://github.com/xnuinside/simple-ddl-parser/blob/main/tests/test_checks.py#L10 if will be any more issues, feel free to open new issue. And sorry for the delay one more time.

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