diff --git a/ingestion/src/metadata/ingestion/source/dashboard/tableau/client.py b/ingestion/src/metadata/ingestion/source/dashboard/tableau/client.py index 56b51efb02a..05924946a83 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/tableau/client.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/tableau/client.py @@ -110,7 +110,7 @@ class TableauClient: owner = self.tableau_server.users.get_by_id(owner_id) if owner_id else None if owner and owner.email: owner_obj = TableauOwner( - id=owner.id, name=owner.name, email=owner.email + id=str(owner.id), name=owner.name, email=owner.email ) self.owner_cache[owner_id] = owner_obj return owner_obj @@ -130,7 +130,7 @@ class TableauClient: try: charts.append( TableauChart( - id=view.id, + id=str(view.id), name=view.name, tags=view.tags, owner=self.get_tableau_owner(view.owner_id), @@ -212,10 +212,10 @@ class TableauClient: workbook.views ) workbook = TableauDashboard( - id=workbook.id, + id=str(workbook.id), name=workbook.name, project=TableauBaseModel( - id=workbook.project_id, name=workbook.project_name + id=str(workbook.project_id), name=workbook.project_name ), owner=self.get_tableau_owner(workbook.owner_id), description=workbook.description, diff --git a/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py b/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py index d34b7f01953..2f7f3d38386 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/tableau/metadata.py @@ -253,6 +253,7 @@ class TableauSource(DashboardServiceSource): ), sql=self._get_datamodel_sql_query(data_model=data_model), owners=self.get_owner_ref(dashboard_details=dashboard_details), + project=self.get_project_name(dashboard_details=dashboard_details), ) yield Either(right=data_model_request) self.register_record_datamodel(datamodel_request=data_model_request) diff --git a/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py b/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py index 5957540f791..731f2eccda9 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/tableau/models.py @@ -13,6 +13,7 @@ Tableau Source Model module """ +import uuid from typing import Dict, List, Optional, Set, Union from pydantic import BaseModel, ConfigDict, Field, field_validator @@ -28,9 +29,18 @@ class TableauBaseModel(BaseModel): model_config = ConfigDict(extra="allow") - id: str + # in case of personal space workbooks, the project id is returned as a UUID + id: Union[str, uuid.UUID] name: Optional[str] = None + # pylint: disable=no-self-argument + @field_validator("id", mode="before") + def coerce_uuid_to_string(cls, value): + """Ensure id is always stored as a string internally""" + if isinstance(value, uuid.UUID): + return str(value) + return value + def __hash__(self): return hash(self.id) @@ -187,7 +197,7 @@ class TableauDashboard(TableauBaseModel): tags: Optional[Set] = [] webpageUrl: Optional[str] = None charts: Optional[List[TableauChart]] = None - dataModels: List[DataSource] = [] + dataModels: Optional[List[DataSource]] = [] custom_sql_queries: Optional[List[str]] = None user_views: Optional[int] = None