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

UNION within CTE causes error #376

Closed
kevinkelleher12 opened this issue May 26, 2023 · 1 comment
Closed

UNION within CTE causes error #376

kevinkelleher12 opened this issue May 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@kevinkelleher12
Copy link

Thank you for developing this library! I'm getting an error when using UNION within a CTE:

CREATE TABLE OUT AS
WITH CTE AS (
SELECT COL1, COL2
FROM IN1
UNION ALL
SELECT COL1, COL2
FROM IN2
)
SELECT COL1, COL2
FROM CTE
;
'''
result = LineageRunner(sql, dialect='ansi')
print(result)

I'm wondering if when get_subqueries calls segment.get_child("set_expression") if this should be some kind of recursive search, but not sure.

@reata reata added the bug Something isn't working label May 31, 2023
@reata
Copy link
Owner

reata commented May 31, 2023

Yes this causes internal failure. If we can make this recursive search it's all the better. Or we can just patch it with a special logic to handle segment.type == "with_compound_statement' case. Are you interested in a PR? I think you're very close to solving it.

duongphannamhung added a commit to duongphannamhung/sqllineage that referenced this issue Jun 15, 2023
extract and parse union in cte in issues reata#376
@reata reata closed this as completed Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants