Skip to content

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

Description

@Querela

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;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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