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

Not Using Column Name Specified in Query For CTE within Query #486

Closed
maoxingda opened this issue Dec 1, 2023 · 1 comment · Fixed by #492
Closed

Not Using Column Name Specified in Query For CTE within Query #486

maoxingda opened this issue Dec 1, 2023 · 1 comment · Fixed by #492
Labels
bug Something isn't working

Comments

@maoxingda
Copy link
Contributor

Describe the bug

  • When the column names in the target table are different from those in the source table, the column lineage is incorrect.

SQL
Paste the SQL text here. For example:

insert into
    public.tgt_tbl1
(
    id
)
with
    cte1 as (
        select name from public.src_tbl1
    )
select
    name
from
    cte1
;

To Reproduce
Note here we refer to SQL provided in prior step as stored in a file named test.sql

with open(sql_file, 'r') as f:
    sql = f.read()

lr = LineageRunner(sql, dialect='redshift')

lr.print_column_lineage()
public.tgt_tbl1.name <- cte1.name <- public.src_tbl1.name

Expected behavior

public.tgt_tbl1.id <- cte1.name <- public.src_tbl1.name

Python version (available via python --version)

  • 3.11.5

SQLLineage version (available via sqllineage --version):

  • 1.4.8
@maoxingda maoxingda added the bug Something isn't working label Dec 1, 2023
@reata reata changed the title Incorrect column lineage Not Using Column Name Specified in Query Dec 3, 2023
@reata
Copy link
Owner

reata commented Dec 3, 2023

Bug confirmed. Thanks for reporting.

@reata reata changed the title Not Using Column Name Specified in Query Not Using Column Name Specified in Query For CTE within Query Dec 9, 2023
@reata reata closed this as completed in #492 Dec 9, 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

Successfully merging a pull request may close this issue.

2 participants