macbre / sql-metadata

Uses tokenized query returned by python-sqlparse and generates query metadata

Home Page:https://pypi.python.org/pypi/sql-metadata

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

parser.columns lost the 2nd `` quoted columns with operation

zhaorenjie opened this issue · comments

reproduce in 2.9.0

>>> Parser("select `col1 with space` / `col2_anything` from table1;").columns
['col1 with space']
>>> Parser("select `col1 with space` / `col2_anything` from table1;").columns_aliases
{'col2_anything': 'col1 with space'}
>>> Parser("select `col1 with space` / `col2_anything` from table1;").columns_dict
{'select': ['col1 with space']}
>>> Parser("select `col1 with space` / `col2_anything` from table1;").columns_aliases_dict
{'select': ['col2_anything']}

I think the correct answer should be ['col1 with space', 'col2_anything'], but col2_anything is now recognized as "alias" ?