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
This commit is contained in:
Ayush Shah 2022-04-22 16:19:55 +05:30 committed by GitHub
parent 2bd5d02b2b
commit a94bb5fc8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -62,14 +62,15 @@
"description": "Tableau Environment Name", "description": "Tableau Environment Name",
"type": "string" "type": "string"
}, },
"dbServiceName": {
"description": "Database Service Name in order to create a lineage",
"type": "string"
},
"supportsMetadataExtraction": { "supportsMetadataExtraction": {
"title": "Supports Metadata Extraction", "title": "Supports Metadata Extraction",
"$ref": "../connectionBasicType.json#/definitions/supportsMetadataExtraction" "$ref": "../connectionBasicType.json#/definitions/supportsMetadataExtraction"
} }
}, },
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": ["hostPort", "apiVersion", "siteName"]
"hostPort",
"username"
]
} }

View File

@ -174,7 +174,7 @@ class TableauSource(Source[Entity]):
try: try:
table_fqdn = datasource.split("(")[1].split(")")[0] table_fqdn = datasource.split("(")[1].split(")")[0]
dashboard_fqdn = f"{self.config.serviceName}.{dashboard_name}" 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( table_entity = self.metadata_client.get_by_name(
entity=Table, fqdn=table_fqdn entity=Table, fqdn=table_fqdn
) )
@ -194,6 +194,7 @@ class TableauSource(Source[Entity]):
) )
yield lineage yield lineage
except (Exception, IndexError) as err: except (Exception, IndexError) as err:
logger.debug(traceback.format_exc())
logger.error(err) logger.error(err)
def _get_tableau_dashboard(self) -> Dashboard: def _get_tableau_dashboard(self) -> Dashboard:
@ -223,7 +224,7 @@ class TableauSource(Source[Entity]):
chart = self.all_dashboard_details["workbook"][chart_index] chart = self.all_dashboard_details["workbook"][chart_index]
if chart["id"] == dashboard_id: if chart["id"] == dashboard_id:
dashboard_chart.append( dashboard_chart.append(
self.all_dashboard_details["name"][chart_index] self.all_dashboard_details["id"][chart_index]
) )
yield Dashboard( yield Dashboard(
id=uuid.uuid4(), id=uuid.uuid4(),
@ -240,7 +241,7 @@ class TableauSource(Source[Entity]):
last_modified=dateparser.parse(chart["updatedAt"]).timestamp() last_modified=dateparser.parse(chart["updatedAt"]).timestamp()
* 1000, * 1000,
) )
if self.config.serviceName: if self.connection_config.dbServiceName:
yield from self.get_lineage(datasource_list, dashboard_id) yield from self.get_lineage(datasource_list, dashboard_id)
except Exception as err: except Exception as err:
logger.debug(traceback.format_exc()) logger.debug(traceback.format_exc())

View File

@ -219,9 +219,11 @@ class OMetaServiceTest(TestCase):
"username": "tb_user", "username": "tb_user",
"password": "tb_pwd", "password": "tb_pwd",
"hostPort": "http://random:1234", "hostPort": "http://random:1234",
"siteName": "openmetadata",
"apiVersion": "3.15",
} }
}, },
"sourceConfig": {"config": {}}, "sourceConfig": {"config": {"topicFilterPattern": {}}},
} }
workflow_source = WorkflowSource(**data) workflow_source = WorkflowSource(**data)