feat(ingest/tableau): support dashboard tags (#6185)

This commit is contained in:
Harshal Sheth 2022-10-12 22:34:35 +00:00 committed by GitHub
parent c0d42deab7
commit c7cc0af6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -1099,9 +1099,7 @@ class TableauSource(StatefulIngestionSourceBase):
# Tags # Tags
tag_list = sheet.get("tags", []) tag_list = sheet.get("tags", [])
if tag_list and self.config.ingest_tags: if tag_list and self.config.ingest_tags:
tag_list_str = [ tag_list_str = [t.get("name", "") for t in tag_list if t is not None]
t.get("name", "").upper() for t in tag_list if t is not None
]
chart_snapshot.aspects.append( chart_snapshot.aspects.append(
builder.make_global_tag_aspect_with_tag_list(tag_list_str) builder.make_global_tag_aspect_with_tag_list(tag_list_str)
) )
@ -1140,7 +1138,7 @@ class TableauSource(StatefulIngestionSourceBase):
tag_list = workbook.get("tags", []) tag_list = workbook.get("tags", [])
tag_list_str = ( tag_list_str = (
[t.get("name", "").upper() for t in tag_list if t is not None] [t.get("name", "") for t in tag_list if t is not None]
if (tag_list and self.config.ingest_tags) if (tag_list and self.config.ingest_tags)
else None else None
) )
@ -1246,6 +1244,13 @@ class TableauSource(StatefulIngestionSourceBase):
) )
dashboard_snapshot.aspects.append(dashboard_info_class) dashboard_snapshot.aspects.append(dashboard_info_class)
tag_list = dashboard.get("tags", [])
if tag_list and self.config.ingest_tags:
tag_list_str = [t.get("name", "") for t in tag_list if t is not None]
dashboard_snapshot.aspects.append(
builder.make_global_tag_aspect_with_tag_list(tag_list_str)
)
if self.config.extract_usage_stats: if self.config.extract_usage_stats:
# dashboard_snapshot doesn't support the stat aspect as list element and hence need to emit MetadataWorkUnit # dashboard_snapshot doesn't support the stat aspect as list element and hence need to emit MetadataWorkUnit
wu = self._get_dashboard_stat_wu(dashboard, dashboard_urn) wu = self._get_dashboard_stat_wu(dashboard, dashboard_urn)

View File

@ -127,6 +127,9 @@ workbook_graphql_query = """
id id
name name
} }
tags {
name
}
} }
embeddedDatasources { embeddedDatasources {
id id

View File

@ -597,7 +597,7 @@
"changeType": "UPSERT", "changeType": "UPSERT",
"aspectName": "globalTags", "aspectName": "globalTags",
"aspect": { "aspect": {
"value": "{\"tags\": [{\"tag\": \"urn:li:tag:TAGSHEET3\"}]}", "value": "{\"tags\": [{\"tag\": \"urn:li:tag:TagSheet3\"}]}",
"contentType": "application/json" "contentType": "application/json"
}, },
"systemMetadata": { "systemMetadata": {
@ -817,7 +817,7 @@
"com.linkedin.pegasus2avro.common.GlobalTags": { "com.linkedin.pegasus2avro.common.GlobalTags": {
"tags": [ "tags": [
{ {
"tag": "urn:li:tag:TAGSHEET3" "tag": "urn:li:tag:TagSheet3"
} }
] ]
} }