mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-19 14:44:37 +00:00
feat(ingestion): Tableau # Embed links (#6994)
This commit is contained in:
parent
ff49d943bc
commit
dcf389d35f
@ -97,6 +97,7 @@ from datahub.metadata.schema_classes import (
|
|||||||
DashboardUsageStatisticsClass,
|
DashboardUsageStatisticsClass,
|
||||||
DataPlatformInstanceClass,
|
DataPlatformInstanceClass,
|
||||||
DatasetPropertiesClass,
|
DatasetPropertiesClass,
|
||||||
|
EmbedClass,
|
||||||
OwnerClass,
|
OwnerClass,
|
||||||
OwnershipClass,
|
OwnershipClass,
|
||||||
OwnershipTypeClass,
|
OwnershipTypeClass,
|
||||||
@ -253,6 +254,11 @@ class TableauConfig(
|
|||||||
default=None, description=""
|
default=None, description=""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ingest_embed_url: Optional[bool] = Field(
|
||||||
|
default=True,
|
||||||
|
description="Ingest a URL to render an embedded Preview of assets within Tableau.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class WorkbookKey(PlatformKey):
|
class WorkbookKey(PlatformKey):
|
||||||
workbook_id: str
|
workbook_id: str
|
||||||
@ -1319,7 +1325,13 @@ class TableauSource(StatefulIngestionSourceBase):
|
|||||||
builder.make_global_tag_aspect_with_tag_list(tag_list_str)
|
builder.make_global_tag_aspect_with_tag_list(tag_list_str)
|
||||||
)
|
)
|
||||||
yield self.get_metadata_change_event(chart_snapshot)
|
yield self.get_metadata_change_event(chart_snapshot)
|
||||||
|
if sheet_external_url is not None and self.config.ingest_embed_url is True:
|
||||||
|
yield self.new_work_unit(
|
||||||
|
self.new_embed_aspect_mcp(
|
||||||
|
entity_urn=sheet_urn,
|
||||||
|
embed_url=sheet_external_url,
|
||||||
|
)
|
||||||
|
)
|
||||||
workunits = add_entity_to_container(
|
workunits = add_entity_to_container(
|
||||||
self.gen_workbook_key(workbook), "chart", chart_snapshot.urn
|
self.gen_workbook_key(workbook), "chart", chart_snapshot.urn
|
||||||
)
|
)
|
||||||
@ -1463,6 +1475,43 @@ class TableauSource(StatefulIngestionSourceBase):
|
|||||||
entityUrn=dashboard_urn,
|
entityUrn=dashboard_urn,
|
||||||
).as_workunit()
|
).as_workunit()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def new_mcp(
|
||||||
|
entity_urn: str,
|
||||||
|
aspect_name: str,
|
||||||
|
aspect: builder.Aspect,
|
||||||
|
change_type: Union[str, ChangeTypeClass] = ChangeTypeClass.UPSERT,
|
||||||
|
) -> MetadataChangeProposalWrapper:
|
||||||
|
"""
|
||||||
|
Create MCP
|
||||||
|
"""
|
||||||
|
return MetadataChangeProposalWrapper(
|
||||||
|
changeType=change_type,
|
||||||
|
entityUrn=entity_urn,
|
||||||
|
aspectName=aspect_name,
|
||||||
|
aspect=aspect,
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def new_embed_aspect_mcp(
|
||||||
|
entity_urn: str, embed_url: str
|
||||||
|
) -> MetadataChangeProposalWrapper:
|
||||||
|
return TableauSource.new_mcp(
|
||||||
|
entity_urn=entity_urn,
|
||||||
|
aspect_name=EmbedClass.ASPECT_NAME,
|
||||||
|
aspect=EmbedClass(renderUrl=embed_url),
|
||||||
|
)
|
||||||
|
|
||||||
|
def new_work_unit(self, mcp: MetadataChangeProposalWrapper) -> MetadataWorkUnit:
|
||||||
|
return MetadataWorkUnit(
|
||||||
|
id="{PLATFORM}-{ENTITY_URN}-{ASPECT_NAME}".format(
|
||||||
|
PLATFORM=self.config.platform,
|
||||||
|
ENTITY_URN=mcp.entityUrn,
|
||||||
|
ASPECT_NAME=mcp.aspectName,
|
||||||
|
),
|
||||||
|
mcp=mcp,
|
||||||
|
)
|
||||||
|
|
||||||
def emit_dashboards(self, workbook: Dict) -> Iterable[MetadataWorkUnit]:
|
def emit_dashboards(self, workbook: Dict) -> Iterable[MetadataWorkUnit]:
|
||||||
for dashboard in workbook.get("dashboards", []):
|
for dashboard in workbook.get("dashboards", []):
|
||||||
dashboard_urn: str = builder.make_dashboard_urn(
|
dashboard_urn: str = builder.make_dashboard_urn(
|
||||||
@ -1533,6 +1582,14 @@ class TableauSource(StatefulIngestionSourceBase):
|
|||||||
dashboard_snapshot.aspects.append(owner)
|
dashboard_snapshot.aspects.append(owner)
|
||||||
|
|
||||||
yield self.get_metadata_change_event(dashboard_snapshot)
|
yield self.get_metadata_change_event(dashboard_snapshot)
|
||||||
|
# Yield embed MCP
|
||||||
|
if self.config.ingest_embed_url is True:
|
||||||
|
yield self.new_work_unit(
|
||||||
|
self.new_embed_aspect_mcp(
|
||||||
|
entity_urn=dashboard_urn,
|
||||||
|
embed_url=dashboard_external_url,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
workunits = add_entity_to_container(
|
workunits = add_entity_to_container(
|
||||||
self.gen_workbook_key(workbook), "dashboard", dashboard_snapshot.urn
|
self.gen_workbook_key(workbook), "dashboard", dashboard_snapshot.urn
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user