Skip to content

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

@galenseilis

Description

@galenseilis

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.

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