reata / sqllineage

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

When parsing a segment of SQL, although the field-level relationships exist, the source table information is lost. #634

Open xiaolongsoft opened 5 months ago

xiaolongsoft commented 5 months ago

Describe the bug When parsing a segment of SQL, although the field-level relationships exist, the source table information is lost. existing table prefixes have also been replaced with "default.".

SQL Paste the SQL text here. For example:

insert into foo.tb1  select f1,f2,(select f3 from  bar.tb1) b3 from  foo.tb2

For example:


MetaData = {"bar.tb1": ["f1", "f2", "f3"]}

provider = DummyMetaDataProvider(MetaData)

LineageRunner = sqllineage.runner.LineageRunner(sql, metadata_provider=provider, verbose=True)

LineageRunner.print_column_lineage()
print("=======source_tables:")
print(LineageRunner.source_tables)

result:

foo.tb1.b3 <- <default>.tb1.f3
foo.tb1.f1 <- foo.tb2.f1
foo.tb1.f2 <- foo.tb2.f2
=======source_tables:
[Table: foo.tb2]

Expected behavior I hope to correctly display the prefix bar. for tb1.f3 and bar.tb1 in source_tables

Python version (available via python --version)

SQLLineage version (available via sqllineage --version):

Additional context Add any other context about the problem here.