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

"on" and "ON" are table aliases? #537

Open
galenseilis opened this issue Dec 18, 2024 · 0 comments
Open

"on" and "ON" are table aliases? #537

galenseilis opened this issue Dec 18, 2024 · 0 comments

Comments

@galenseilis
Copy link

I just ran this example, which is adjusted from one of the examples on the README.

# foo.py
from sql_metadata import Parser

parser = Parser(
    """
WITH
    database1.tableFromWith AS (SELECT aa.* FROM table3 as aa 
                                left join table4 on aa.col1=table4.col2),
    test as (SELECT * from table3)
SELECT
  "xxxxx"
FROM
  database1.[tableFromWith] alias
LEFT JOIN database2.table2 ON ("tt"."ttt"."fff" = "xx"."xxx")
"""
)

print(parser.tables_aliases)

I am getting this result:

> python foo.py
{'aa': 'table3', 'on': 'table4', 'alias': 'database1.[tableFromWith]', 'ON': 'database2.table2'} 
  • Is this intended behaviour?
  • If this behaviour is desired, please explain how to interpret it.
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