mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-30 11:56:01 +00:00
ISSUE-17045: Modified to create column linage even when upstream columns and data source columns are one-to-many (#17112)
Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com>
This commit is contained in:
parent
3d8d8566cc
commit
43a244fbf1
@ -313,17 +313,18 @@ class TableauSource(DashboardServiceSource):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_data_model_column_fqn(
|
def _get_data_model_column_fqn(
|
||||||
data_model_entity: DashboardDataModel, column: str
|
data_model_entity: DashboardDataModel, column: str
|
||||||
) -> Optional[str]:
|
) -> Optional[List[str]]:
|
||||||
"""
|
"""
|
||||||
Get fqn of column if exist in table entity
|
Get fqn of column if exist in table entity
|
||||||
"""
|
"""
|
||||||
if not data_model_entity:
|
if not data_model_entity:
|
||||||
return None
|
return None
|
||||||
|
columns = []
|
||||||
for tbl_column in data_model_entity.columns:
|
for tbl_column in data_model_entity.columns:
|
||||||
for child_column in tbl_column.children or []:
|
for child_column in tbl_column.children or []:
|
||||||
if column.lower() == child_column.name.root.lower():
|
if column.lower() == child_column.name.root.lower():
|
||||||
return child_column.fullyQualifiedName.root
|
columns.append(child_column.fullyQualifiedName.root)
|
||||||
return None
|
return columns
|
||||||
|
|
||||||
def _get_column_lineage( # pylint: disable=arguments-differ
|
def _get_column_lineage( # pylint: disable=arguments-differ
|
||||||
self,
|
self,
|
||||||
@ -342,13 +343,15 @@ class TableauSource(DashboardServiceSource):
|
|||||||
from_column = get_column_fqn(
|
from_column = get_column_fqn(
|
||||||
table_entity=table_entity, column=column.name
|
table_entity=table_entity, column=column.name
|
||||||
)
|
)
|
||||||
to_column = self._get_data_model_column_fqn(
|
to_columns = self._get_data_model_column_fqn(
|
||||||
data_model_entity=data_model_entity,
|
data_model_entity=data_model_entity,
|
||||||
column=column.id,
|
column=column.id,
|
||||||
)
|
)
|
||||||
|
for to_column in to_columns:
|
||||||
column_lineage.append(
|
column_lineage.append(
|
||||||
ColumnLineage(fromColumns=[from_column], toColumn=to_column)
|
ColumnLineage(fromColumns=[from_column], toColumn=to_column)
|
||||||
)
|
)
|
||||||
|
return column_lineage
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.debug(f"Error to get column lineage: {exc}")
|
logger.debug(f"Error to get column lineage: {exc}")
|
||||||
logger.debug(traceback.format_exc())
|
logger.debug(traceback.format_exc())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user