reata / sqllineage

SQL Lineage Analysis Tool powered by Python
MIT License
1.35k stars 241 forks source link

insert into db.tbl_z select * from db.tbl_x with MetaDataProvider error #635

Open gitforzzj opened 4 months ago

gitforzzj commented 4 months ago

Describe the bug

SQL Paste the SQL text here. For example:

insert into db.tbl_z  select *  from db.tbl_x 

API (Application Programming Interface): provide the python code you're using and the output. For example:

providers = generate_metadata_providers(
    {
        "db.tbl_x": ["id", "a", "b"],
        "db.tbl_z": ["pk", "s", "t"],
    }
)

@pytest.mark.parametrize("provider", providers)
def test_select_single_table_wildcard(provider: MetaDataProvider):
    sql = """insert into db.tbl_z
    select *
    from db.tbl_x 
    """
    assert_column_lineage_equal(
        sql,
        [
            (
                ColumnQualifierTuple("id", "db.tbl_x"),
                ColumnQualifierTuple("id", "db.tbl_z"),
            ),
            (
                ColumnQualifierTuple("a", "db.tbl_x"),
                ColumnQualifierTuple("a", "db.tbl_z"),
            ),
            (
                ColumnQualifierTuple("b", "db.tbl_x"),
                ColumnQualifierTuple("b", "db.tbl_z"),
            ),
        ],
        metadata_provider=provider
    )

Expected behavior

{(db.tbl_x.b, db.tbl_z.t), (db.tbl_x.id, db.tbl_z.pk), (db.tbl_x.a, db.tbl_z.s)}

actual: {(db.tbl_x.b, db.tbl_z.b), (db.tbl_x.id, db.tbl_z.id), (db.tbl_x.a, db.tbl_z.a)}

Python version (available via python --version)

SQLLineage version (available via sqllineage --version):