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

Parse error in where clausel when using operations on a term #8

Open
Querela opened this issue Jan 21, 2019 · 0 comments
Open

Parse error in where clausel when using operations on a term #8

Querela opened this issue Jan 21, 2019 · 0 comments

Comments

@Querela
Copy link

Querela commented Jan 21, 2019

See this example snippet:

>>> format_sql.format_sql('''select a.a from aaa a where ((a.b+1) = 2);''')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/koerner/miniconda3/envs/tests-sql/lib/python3.6/site-packages/format_sql/shortcuts.py", line 20, in format_sql
    parsed = list(parse(tokens))
  File "/home/koerner/miniconda3/envs/tests-sql/lib/python3.6/site-packages/format_sql/parser.py", line 762, in parse
    for statement, unused_count in _parse(toks):
  File "/home/koerner/miniconda3/envs/tests-sql/lib/python3.6/site-packages/format_sql/parser.py", line 756, in _parse
    statement, count = func(toks)
  File "/home/koerner/miniconda3/envs/tests-sql/lib/python3.6/site-packages/format_sql/parser.py", line 596, in _parse_where
    conditions, j = _parse_conditions(toks[1:])
  File "/home/koerner/miniconda3/envs/tests-sql/lib/python3.6/site-packages/format_sql/parser.py", line 701, in _parse_conditions
    raise InvalidCondition()
format_sql.parser.InvalidCondition

It seems that all (most?) queries with the following conditions <table>.<column> + 1 = <some other value> fail to parse:

select a.a from aaa a where a.b+1 = 2;
@Querela Querela changed the title Parser error in where clausel Parse error in where clausel when using operations on a term Jan 21, 2019
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