Skip to content

Column level lineage not drawn properly when metadata is provided #597

@piekill

Description

@piekill

Describe the bug
When I provide the metadata, the printed column level lineage is correct, but the figure generated doesn't contain this information.
Printed column lineage:
<default>.res.c1 <- db1.tab1.c1

image

SQL

insert into res
select c1
from db1.tab1 a join db1.tab2 b

To Reproduce

from sqllineage.core.metadata.dummy import DummyMetaDataProvider
from sqllineage.runner import LineageRunner

sql = """
insert into res
select c1
from db1.tab1 a join db1.tab2 b
"""
lr = LineageRunner(sql, metadata_provider=DummyMetaDataProvider({"db1.tab1": ["c1"], "db1.tab2": ["c2"]}))
lr.print_column_lineage()
lr.draw()

Expected behavior
If I use the following sql (replace c1 with a.c1):

insert into res
select a.c1
from db1.tab1 a join db1.tab2 b

I can get the expected figure (the printed column lineage is the same):
image

Python version (available via python --version)

  • 3.11.8

SQLLineage version (available via sqllineage --version):

  • 1.5.2

Updated
I think the reason is that metadata provider is not currently used in visualization:

lr = LineageRunner(sql, dialect=dialect, verbose=True)

I can get the expected behavior if I manually set the metadata_provider here. I guess there could be a better way of doing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions