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

Dialect Postgresql, union lineage only pick up last unioned table #1934

Closed
sluofoss opened this issue Jul 20, 2023 · 0 comments
Closed

Dialect Postgresql, union lineage only pick up last unioned table #1934

sluofoss opened this issue Jul 20, 2023 · 0 comments

Comments

@sluofoss
Copy link

Consider the following SQL:

select ca as c from a
union all
select cb as c from b
union all
select cc as c from c

running

node = lineage("c",file_content,dialect = Dialects.POSTGRES)
meta = LineageHTML(node)

only shows the last unioned table, ideally it should show all of them?


Code snippet to reproduce:

import sqlglot
from sqlglot.lineage import lineage, LineageHTML
from sqlglot.dialects.dialect import Dialects


file_content = """
select ca as c from a
union all
select cb as c from b
union all
select cc as c from c
"""

node = lineage("c",file_content,dialect = Dialects.POSTGRES)

meta = LineageHTML(node)

with open("./eg.html", 'w') as file:
    # Write the string to the file
    file.write(str(meta))

https://sqlglot.com/sqlglot/lineage.html

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