Skip to content

Commit

Permalink
fix(ingest/powerbi): fix broken lineage between chart and dataset (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
sid-acryl authored Aug 7, 2024
1 parent 543e447 commit 2755cf3
Show file tree
Hide file tree
Showing 4 changed files with 368 additions and 351 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
from datahub.metadata.urns import ChartUrn
from datahub.sql_parsing.sqlglot_lineage import ColumnLineageInfo
from datahub.utilities.dedup_list import deduplicate_list
from datahub.utilities.urns.urn_iter import lowercase_dataset_urn

# Logger instance
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -127,7 +128,7 @@ def __init__(
@staticmethod
def urn_to_lowercase(value: str, flag: bool) -> str:
if flag is True:
return value.lower()
return lowercase_dataset_urn(value)

return value

Expand Down Expand Up @@ -390,11 +391,13 @@ def to_datahub_dataset(

for table in dataset.tables:
# Create a URN for dataset
ds_urn = builder.make_dataset_urn_with_platform_instance(
platform=self.__config.platform_name,
name=self.assets_urn_to_lowercase(table.full_name),
platform_instance=self.__config.platform_instance,
env=self.__config.env,
ds_urn = self.assets_urn_to_lowercase(
builder.make_dataset_urn_with_platform_instance(
platform=self.__config.platform_name,
name=table.full_name,
platform_instance=self.__config.platform_instance,
env=self.__config.env,
)
)

logger.debug(f"dataset_urn={ds_urn}")
Expand Down
6 changes: 3 additions & 3 deletions metadata-ingestion/src/datahub/utilities/urns/urn_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _modify_at_path(
_modify_at_path(getattr(model, path[0]), path[1:], new_value)


def _lowercase_dataset_urn(dataset_urn: str) -> str:
def lowercase_dataset_urn(dataset_urn: str) -> str:
cur_urn = DatasetUrn.from_string(dataset_urn)
new_urn = DatasetUrn(
platform=cur_urn.platform, name=cur_urn.name.lower(), env=cur_urn.env
Expand All @@ -149,10 +149,10 @@ def lowercase_dataset_urns(
) -> None:
def modify_urn(urn: str) -> str:
if guess_entity_type(urn) == "dataset":
return _lowercase_dataset_urn(urn)
return lowercase_dataset_urn(urn)
elif guess_entity_type(urn) == "schemaField":
cur_urn = Urn.from_string(urn)
cur_urn._entity_ids[0] = _lowercase_dataset_urn(cur_urn._entity_ids[0])
cur_urn._entity_ids[0] = lowercase_dataset_urn(cur_urn._entity_ids[0])
return str(cur_urn)
return urn

Expand Down
Loading

0 comments on commit 2755cf3

Please sign in to comment.