From a94bb5fc8e34e379ae52b3864dfe0eb3a8b336fd Mon Sep 17 00:00:00 2001 From: Ayush Shah Date: Fri, 22 Apr 2022 16:19:55 +0530 Subject: [PATCH] Fixes Tableau + fix Charts not getting ingested as part of dashboard (#4327) * Fixes Tableau + fix Charts not getting ingested as part of dashboard * pytest fix * Fix Tableau json config --- .../connections/dashboard/tableauConnection.json | 9 +++++---- ingestion/src/metadata/ingestion/source/tableau.py | 7 ++++--- .../tests/integration/ometa/test_ometa_service_api.py | 4 +++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json index e4e8e41a59f..16adc6098c2 100644 --- a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json +++ b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json @@ -62,14 +62,15 @@ "description": "Tableau Environment Name", "type": "string" }, + "dbServiceName": { + "description": "Database Service Name in order to create a lineage", + "type": "string" + }, "supportsMetadataExtraction": { "title": "Supports Metadata Extraction", "$ref": "../connectionBasicType.json#/definitions/supportsMetadataExtraction" } }, "additionalProperties": false, - "required": [ - "hostPort", - "username" - ] + "required": ["hostPort", "apiVersion", "siteName"] } diff --git a/ingestion/src/metadata/ingestion/source/tableau.py b/ingestion/src/metadata/ingestion/source/tableau.py index 504fe1f2887..bd7607bbad3 100644 --- a/ingestion/src/metadata/ingestion/source/tableau.py +++ b/ingestion/src/metadata/ingestion/source/tableau.py @@ -174,7 +174,7 @@ class TableauSource(Source[Entity]): try: table_fqdn = datasource.split("(")[1].split(")")[0] dashboard_fqdn = f"{self.config.serviceName}.{dashboard_name}" - table_fqdn = f"{self.config.serviceName}.{table_fqdn}" + table_fqdn = f"{self.connection_config.dbServiceName}.{table_fqdn}" table_entity = self.metadata_client.get_by_name( entity=Table, fqdn=table_fqdn ) @@ -194,6 +194,7 @@ class TableauSource(Source[Entity]): ) yield lineage except (Exception, IndexError) as err: + logger.debug(traceback.format_exc()) logger.error(err) def _get_tableau_dashboard(self) -> Dashboard: @@ -223,7 +224,7 @@ class TableauSource(Source[Entity]): chart = self.all_dashboard_details["workbook"][chart_index] if chart["id"] == dashboard_id: dashboard_chart.append( - self.all_dashboard_details["name"][chart_index] + self.all_dashboard_details["id"][chart_index] ) yield Dashboard( id=uuid.uuid4(), @@ -240,7 +241,7 @@ class TableauSource(Source[Entity]): last_modified=dateparser.parse(chart["updatedAt"]).timestamp() * 1000, ) - if self.config.serviceName: + if self.connection_config.dbServiceName: yield from self.get_lineage(datasource_list, dashboard_id) except Exception as err: logger.debug(traceback.format_exc()) diff --git a/ingestion/tests/integration/ometa/test_ometa_service_api.py b/ingestion/tests/integration/ometa/test_ometa_service_api.py index 34843076ef4..f57d79177da 100644 --- a/ingestion/tests/integration/ometa/test_ometa_service_api.py +++ b/ingestion/tests/integration/ometa/test_ometa_service_api.py @@ -219,9 +219,11 @@ class OMetaServiceTest(TestCase): "username": "tb_user", "password": "tb_pwd", "hostPort": "http://random:1234", + "siteName": "openmetadata", + "apiVersion": "3.15", } }, - "sourceConfig": {"config": {}}, + "sourceConfig": {"config": {"topicFilterPattern": {}}}, } workflow_source = WorkflowSource(**data)