Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tableau): emit lineage edge from embedded datasource to upstream… #4470

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions metadata-ingestion/src/datahub/ingestion/source/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@ def _create_upstream_table_lineage(
table.get("columns", []),
table_path,
)

for datasource in datasource.get("upstreamDatasources", []):
datasource_urn = builder.make_dataset_urn(
self.platform, datasource.get("id", ""), self.config.env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mayurinehate, should the name param here be datasource["name"] + datasource.get("id", "")? Is the id optional? Also, do we need any updates to the documentation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Only dataset["id"] should be used in urn. It is consistent with other places where we generate urn in order to set lineage correctly.
  2. Id is not optional. updated code for this commit
  3. Added Lineage section in tableau doc to mention lineages emitted

)
upstream_table = UpstreamClass(
dataset=datasource_urn,
type=DatasetLineageTypeClass.TRANSFORMED,
)
upstream_tables.append(upstream_table)

return upstream_tables

def emit_custom_sql_datasources(self) -> Iterable[MetadataWorkUnit]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ class MetadataQueryException(Exception):
dataType
}
}
upstreamDatasources {
id
name
}
workbook {
name
projectName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3843,6 +3843,7 @@
],
"upstreamDatasources": [
{
"id": "6cbbeeb2-9f3a-00f6-2342-17139d6e97ae",
"name": "Superstore Datasource"
}
],
Expand Down Expand Up @@ -21858,6 +21859,7 @@
],
"upstreamDatasources": [
{
"id": "00cce29f-b561-bb41-3557-8e19660bb5dd",
"name": "test publish datasource"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5369,7 +5369,7 @@
"changeType": "UPSERT",
"aspectName": "upstreamLineage",
"aspect": {
"value": "{\"upstreams\": [{\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:external,Sample - Superstore.xls.People,PROD)\", \"type\": \"TRANSFORMED\"}, {\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:external,Sample - Superstore.xls.Returns,PROD)\", \"type\": \"TRANSFORMED\"}, {\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:external,Sample - Superstore.xls.Orders,PROD)\", \"type\": \"TRANSFORMED\"}]}",
"value": "{\"upstreams\": [{\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:external,Sample - Superstore.xls.People,PROD)\", \"type\": \"TRANSFORMED\"}, {\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:external,Sample - Superstore.xls.Returns,PROD)\", \"type\": \"TRANSFORMED\"}, {\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:external,Sample - Superstore.xls.Orders,PROD)\", \"type\": \"TRANSFORMED\"}, {\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:tableau,6cbbeeb2-9f3a-00f6-2342-17139d6e97ae,PROD)\", \"type\": \"TRANSFORMED\"}]}",
"contentType": "application/json"
},
"systemMetadata": {
Expand Down Expand Up @@ -39666,6 +39666,25 @@
"properties": null
}
},
{
"auditHeader": null,
"entityType": "dataset",
"entityUrn": "urn:li:dataset:(urn:li:dataPlatform:tableau,d8d4c0ea-3162-fa11-31e6-26675da44a38,PROD)",
"entityKeyAspect": null,
"changeType": "UPSERT",
"aspectName": "upstreamLineage",
"aspect": {
"value": "{\"upstreams\": [{\"auditStamp\": {\"time\": 0, \"actor\": \"urn:li:corpuser:unknown\"}, \"dataset\": \"urn:li:dataset:(urn:li:dataPlatform:tableau,00cce29f-b561-bb41-3557-8e19660bb5dd,PROD)\", \"type\": \"TRANSFORMED\"}]}",
"contentType": "application/json"
},
"systemMetadata": {
"lastObserved": 1638860400000,
"runId": "tableau-test",
"registryName": null,
"registryVersion": null,
"properties": null
}
},
{
"auditHeader": null,
"proposedSnapshot": {
Expand Down