From c7cc0af6aefabf1ebc9b0ee7a35bbd1f0d3cfe35 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Wed, 12 Oct 2022 22:34:35 +0000 Subject: [PATCH] feat(ingest/tableau): support dashboard tags (#6185) --- .../src/datahub/ingestion/source/tableau.py | 13 +++++++++---- .../src/datahub/ingestion/source/tableau_common.py | 3 +++ .../integration/tableau/tableau_mces_golden.json | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/tableau.py b/metadata-ingestion/src/datahub/ingestion/source/tableau.py index c61d6ac3ea..3657548bd0 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/tableau.py +++ b/metadata-ingestion/src/datahub/ingestion/source/tableau.py @@ -1099,9 +1099,7 @@ class TableauSource(StatefulIngestionSourceBase): # Tags tag_list = sheet.get("tags", []) if tag_list and self.config.ingest_tags: - tag_list_str = [ - t.get("name", "").upper() for t in tag_list if t is not None - ] + tag_list_str = [t.get("name", "") for t in tag_list if t is not None] chart_snapshot.aspects.append( 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_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) else None ) @@ -1246,6 +1244,13 @@ class TableauSource(StatefulIngestionSourceBase): ) 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: # 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) diff --git a/metadata-ingestion/src/datahub/ingestion/source/tableau_common.py b/metadata-ingestion/src/datahub/ingestion/source/tableau_common.py index 141d5b30a4..d93320dd66 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/tableau_common.py +++ b/metadata-ingestion/src/datahub/ingestion/source/tableau_common.py @@ -127,6 +127,9 @@ workbook_graphql_query = """ id name } + tags { + name + } } embeddedDatasources { id diff --git a/metadata-ingestion/tests/integration/tableau/tableau_mces_golden.json b/metadata-ingestion/tests/integration/tableau/tableau_mces_golden.json index 9cc3b09065..574c8f5436 100644 --- a/metadata-ingestion/tests/integration/tableau/tableau_mces_golden.json +++ b/metadata-ingestion/tests/integration/tableau/tableau_mces_golden.json @@ -597,7 +597,7 @@ "changeType": "UPSERT", "aspectName": "globalTags", "aspect": { - "value": "{\"tags\": [{\"tag\": \"urn:li:tag:TAGSHEET3\"}]}", + "value": "{\"tags\": [{\"tag\": \"urn:li:tag:TagSheet3\"}]}", "contentType": "application/json" }, "systemMetadata": { @@ -817,7 +817,7 @@ "com.linkedin.pegasus2avro.common.GlobalTags": { "tags": [ { - "tag": "urn:li:tag:TAGSHEET3" + "tag": "urn:li:tag:TagSheet3" } ] }