-
Notifications
You must be signed in to change notification settings - Fork 124
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
Bug: table alias missing #184
Comments
There If you change aliases to something else it should work, i.e. query = """
select distinct em1.eid as eid from uw_emp em1, uw_emp em2, uw_payroll p
where em1.eid = em2.eid and em1.eid = p.eid
""" If you want to keep the old aliases you have to quote them, i.e.: query = """
select distinct e1.eid as eid from uw_emp "e1", uw_emp "e2", uw_payroll p
where e1.eid = e2.eid and e1.eid = p.eid
"""
parser = Parser(query)
assert parser.tables == ["uw_emp", "uw_payroll"]
assert parser.tables_aliases == {
'p': 'uw_payroll',
'e1': 'uw_emp',
'e2': 'uw_emp'
} |
It's even reported andialbrecht/sqlparse#399 since... 2018 😅 |
It was fixed in |
Haha, thank you, this is great! I see its merged to their master branch. I will install that version. |
Hi,
I think I have found a bug regarding table aliases. I have the following query:
query = "select distinct e1.eid as eid from uw_emp e1, uw_emp e2, uw_payroll p where e1.eid = e2.eid and e1.eid = p.eid"
print(query.columns, "\n", query.columns_aliases_names, "\n", query.tables, "\n", query.tables_aliases)
which outputs:
['e1.eid', 'e2.eid', 'uw_payroll.eid']
['eid']
['uw_emp', 'uw_payroll']
{'p': 'uw_payroll'}
I am missing e1 and e2 for aliases.
The text was updated successfully, but these errors were encountered: