mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-27 15:38:43 +00:00
Fixed Tableau-Bigquery lineage issue (#12570)
This commit is contained in:
parent
30cdc840ab
commit
0f8ebf4afe
@ -45,6 +45,12 @@ class TableauOwnersNotFound(Exception):
|
||||
"""
|
||||
|
||||
|
||||
class TableauDataModelsException(Exception):
|
||||
"""
|
||||
Raise when Data Source information is not retrieved from the Tableau Graphql Query
|
||||
"""
|
||||
|
||||
|
||||
class TableauClient:
|
||||
"""
|
||||
Wrapper to TableauServerConnection
|
||||
@ -116,6 +122,21 @@ class TableauClient:
|
||||
)
|
||||
]
|
||||
|
||||
def test_get_datamodels(self):
|
||||
"""
|
||||
Method to test the datamodels
|
||||
"""
|
||||
data = self._query_datasources(entities_per_page=1, offset=0)
|
||||
if data:
|
||||
return data
|
||||
raise TableauDataModelsException(
|
||||
"Unable to fetch Data Sources from tableau\n"
|
||||
"Please check if the Tableau Metadata APIs are enabled for you Tableau instance\n"
|
||||
"For more information on enabling the Tableau Metadata APIs follow the link below\n"
|
||||
"https://help.tableau.com/current/api/metadata_api/en-us/docs/meta_api_start.html"
|
||||
"#enable-the-tableau-metadata-api-for-tableau-server\n"
|
||||
)
|
||||
|
||||
def _query_datasources(
|
||||
self, entities_per_page: int, offset: int
|
||||
) -> Optional[TableauDatasources]:
|
||||
|
||||
@ -89,6 +89,7 @@ def test_connection(
|
||||
parameter_dict=TABLEAU_GET_VIEWS_PARAM_DICT,
|
||||
),
|
||||
"GetOwners": client.get_owners,
|
||||
"GetDataModels": client.test_get_datamodels,
|
||||
}
|
||||
|
||||
test_connection_steps(
|
||||
|
||||
@ -29,6 +29,9 @@ from metadata.generated.schema.entity.data.table import Column, DataType, Table
|
||||
from metadata.generated.schema.entity.services.connections.dashboard.tableauConnection import (
|
||||
TableauConnection,
|
||||
)
|
||||
from metadata.generated.schema.entity.services.connections.database.bigQueryConnection import (
|
||||
BigQueryConnection,
|
||||
)
|
||||
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
|
||||
OpenMetadataConnection,
|
||||
)
|
||||
@ -367,6 +370,8 @@ class TableauSource(DashboardServiceSource):
|
||||
if table.database and table.database.name
|
||||
else database_schema_table.get("database")
|
||||
)
|
||||
if isinstance(db_service_entity.connection.config, BigQueryConnection):
|
||||
database_name = None
|
||||
database_name = get_database_name_for_lineage(
|
||||
db_service_entity, database_name
|
||||
)
|
||||
|
||||
@ -440,7 +440,7 @@ def is_safe_sql_query(sql_query: str) -> bool:
|
||||
|
||||
|
||||
def get_database_name_for_lineage(
|
||||
db_service_entity: DatabaseService, default_db_name: str
|
||||
db_service_entity: DatabaseService, default_db_name: Optional[str]
|
||||
) -> Optional[str]:
|
||||
# If the database service supports multiple db or
|
||||
# database service connection details are not available
|
||||
|
||||
@ -27,6 +27,12 @@
|
||||
"description": "Validate if the Owner information is retrieved for Workbooks",
|
||||
"errorMessage": "Failed to fetch Workbook Owners, please validate if user has access to fetch Owners",
|
||||
"mandatory": false
|
||||
},
|
||||
{
|
||||
"name": "GetDataModels",
|
||||
"description": "Validate if the Data Sources(Data Models) information is retrieved for Workbooks",
|
||||
"errorMessage": "Failed to fetch Workbook Data Sources, please validate if user has access to fetch Data Sources and Metadata API is enabled for tableau server",
|
||||
"mandatory": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -93,6 +93,10 @@
|
||||
"title": "Supports Profiler",
|
||||
"$ref": "../connectionBasicType.json#/definitions/supportsProfiler"
|
||||
},
|
||||
"supportsDatabase": {
|
||||
"title": "Supports Database",
|
||||
"$ref": "../connectionBasicType.json#/definitions/supportsDatabase"
|
||||
},
|
||||
"supportsQueryComment": {
|
||||
"title": "Supports Query Comment",
|
||||
"$ref": "../connectionBasicType.json#/definitions/supportsQueryComment"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user