mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 17:34:41 +00:00
fixed lineage error (#16790)
This commit is contained in:
parent
4395455d18
commit
46560e0b47
@ -251,10 +251,23 @@ def _build_table_lineage(
|
|||||||
query: str,
|
query: str,
|
||||||
column_lineage_map: dict,
|
column_lineage_map: dict,
|
||||||
lineage_source: LineageSource = LineageSource.QueryLineage,
|
lineage_source: LineageSource = LineageSource.QueryLineage,
|
||||||
) -> Iterable[Either[AddLineageRequest]]:
|
) -> Either[AddLineageRequest]:
|
||||||
"""
|
"""
|
||||||
Prepare the lineage request generator
|
Prepare the lineage request generator
|
||||||
|
|
||||||
|
Args:
|
||||||
|
from_entity (Table): entity link comes from
|
||||||
|
to_entity (Table): entity to link to
|
||||||
|
from_table_raw_name (str): table entity raw name we link from
|
||||||
|
to_table_raw_name (str): table entity raw name we link to
|
||||||
|
query (str): query
|
||||||
|
column_lineage_map (dict): map of the column lineage
|
||||||
|
lineage_source (LineageSource): lineage source
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Either[AddLineageRequest] with the lineage request or an error
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
col_lineage = get_column_lineage(
|
col_lineage = get_column_lineage(
|
||||||
to_entity=to_entity,
|
to_entity=to_entity,
|
||||||
to_table_raw_name=str(to_table_raw_name),
|
to_table_raw_name=str(to_table_raw_name),
|
||||||
@ -279,7 +292,15 @@ def _build_table_lineage(
|
|||||||
)
|
)
|
||||||
if lineage_details:
|
if lineage_details:
|
||||||
lineage.edge.lineageDetails = lineage_details
|
lineage.edge.lineageDetails = lineage_details
|
||||||
yield Either(right=lineage)
|
return Either(right=lineage)
|
||||||
|
except Exception as e:
|
||||||
|
return Either(
|
||||||
|
left=StackTraceError(
|
||||||
|
name="Lineage",
|
||||||
|
error=f"Error creating lineage for tables [{from_table_raw_name}] and [{to_table_raw_name}]: {e}",
|
||||||
|
stackTrace=traceback.format_exc(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,too-many-locals
|
# pylint: disable=too-many-arguments,too-many-locals
|
||||||
@ -325,7 +346,8 @@ def _create_lineage_by_table_name(
|
|||||||
for from_entity, to_entity in itertools.product(
|
for from_entity, to_entity in itertools.product(
|
||||||
from_table_entities, to_table_entities
|
from_table_entities, to_table_entities
|
||||||
):
|
):
|
||||||
yield from _build_table_lineage(
|
if to_entity and from_entity:
|
||||||
|
yield _build_table_lineage(
|
||||||
to_entity=to_entity,
|
to_entity=to_entity,
|
||||||
from_entity=from_entity,
|
from_entity=from_entity,
|
||||||
to_table_raw_name=to_table,
|
to_table_raw_name=to_table,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user