MINOR: Improve UC lineage exception handling (#23081)

(cherry picked from commit 7a6d5cd2fb483705b6e583f032fb24050196aab7)
This commit is contained in:
Mayur Singal 2025-08-25 15:45:51 +05:30 committed by OpenMetadata Release Bot
parent 7d2fe2ddf7
commit c8864a95ab
2 changed files with 44 additions and 24 deletions

View File

@ -63,9 +63,16 @@ def get_column_fqn(table_entity: Table, column: str) -> Optional[str]:
""" """
if not table_entity: if not table_entity:
return None return None
for tbl_column in table_entity.columns: for tbl_column in table_entity.columns or []:
try:
if column.lower() == tbl_column.name.root.lower(): if column.lower() == tbl_column.name.root.lower():
return tbl_column.fullyQualifiedName.root return tbl_column.fullyQualifiedName.root
except Exception as e:
logger.debug(traceback.format_exc())
logger.debug(
f"Error getting column FQN for column [{column}] in"
f"table [{table_entity.fullyQualifiedName}] for column [{tbl_column}]: {e}"
)
return None return None

View File

@ -93,6 +93,7 @@ class UnitycatalogLineageSource(Source):
def _get_lineage_details( def _get_lineage_details(
self, from_table: Table, to_table: Table, databricks_table_fqn: str self, from_table: Table, to_table: Table, databricks_table_fqn: str
) -> Optional[LineageDetails]: ) -> Optional[LineageDetails]:
try:
col_lineage = [] col_lineage = []
for column in to_table.columns: for column in to_table.columns:
column_streams = self.client.get_column_lineage( column_streams = self.client.get_column_lineage(
@ -116,6 +117,12 @@ class UnitycatalogLineageSource(Source):
columnsLineage=col_lineage, source=LineageSource.QueryLineage columnsLineage=col_lineage, source=LineageSource.QueryLineage
) )
return None return None
except Exception as exc:
logger.debug(
f"Error computing column lineage for {to_table.fullyQualifiedName.root} - {exc}"
)
logger.debug(traceback.format_exc())
return None
def _handle_upstream_table( def _handle_upstream_table(
self, self,
@ -157,6 +164,12 @@ class UnitycatalogLineageSource(Source):
) )
), ),
) )
else:
logger.debug(
f"Unable to find upstream entity for "
f"{upstream_table.catalog_name}.{upstream_table.schema_name}.{upstream_table.name}"
f" -> {databricks_table_fqn}"
)
except Exception: except Exception:
logger.debug( logger.debug(
"Error while processing lineage for " "Error while processing lineage for "