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

Linage results are not generated #2780

Closed
tomoki-takahashi-oisix opened this issue Jan 6, 2024 · 1 comment
Closed

Linage results are not generated #2780

tomoki-takahashi-oisix opened this issue Jan 6, 2024 · 1 comment

Comments

@tomoki-takahashi-oisix
Copy link

I tried outputting column level lineage with the following query, but it did not output the desired result.
I specified a WEEK column, so shouldn't this query result in the test2 table?

from sqlglot.lineage import lineage


sql = '''
with
step1 as (
    select
        t1.*
        , d.up_date as week
    from
        test as t1
        left outer join
            test2 as dim_cal
            on
                t1.dim_calendar_id = dim_cal.dim_calendar_id
)

, step2 as (
    select
        *
        , case
            when dayname(fiscal_date_shipping_basis) = 'Tue'
                then 'Mon'
            when dayname(fiscal_date_shipping_basis) = 'Wed'
                then 'Tue'
            when dayname(fiscal_date_shipping_basis) = 'Thu'
                then 'Wed'
            else 'Thu'
        end as dayname_of_closing_date
    from
        step1
)

, test3 as (
    select
        week
        , sales_order_id
        , dayname_of_closing_date
        , is_delete as is_deleted
        , fiscal_date_shipping_basis
        , dim_calendar_id
    from
        step2
)

, final as (
    select
        week
        , sales_order_id
        , is_deleted
        , dayname_of_shipping_date
        , fiscal_date_shipping_basis
        , dim_calendar_id
    from
        test3
)

select *
from
    final
'''
column = 'WEEK'
lin = lineage(column, sql, dialect='snowflake')

with open(f'result.html', 'w') as f:
    f.write(str(lin.to_html()))

result.html

スクリーンショット 2024-01-06 19 49 25
@tobymao
Copy link
Owner

tobymao commented Jan 7, 2024

Screenshot_2024-01-07_14 57 09

i see no issues, make sure you use latest main before filing an issue.

@tobymao tobymao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2024
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

2 participants