Skip to content

Commit 102d66a

Browse files
authored
Fixes #29873: refactor(ingestion): migrate Tableau test-connection to declarative framework (#29886)
* Fixes #29873: refactor(ingestion): migrate Tableau test-connection to declarative framework Replace the imperative test_connection_steps handler with a TableauChecks provider: one @check per step returning Evidence, and a TABLEAU_ERRORS ErrorPack that maps HTTP 401/403/404, TLS failures and the Tableau-specific exceptions to actionable diagnoses, folding in the shared network pack. ServerInfo becomes the ConnectionGate step so a bad server URL or PAT short-circuits the remaining steps instead of re-dialling the host for each. * refactor(ingestion): lean 401 remediation for Tableau test-connection * refactor(ingestion): scope Tableau _status_of to known HTTP-bearing error types * refactor(ingestion): preserve Tableau's 3-minute test-connection timeout
1 parent bb6be20 commit 102d66a

5 files changed

Lines changed: 465 additions & 86 deletions

File tree

ingestion/src/metadata/core/connections/test_connection/checks/dashboard.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@
2222

2323
from __future__ import annotations
2424

25-
from typing import TYPE_CHECKING
25+
from typing import TYPE_CHECKING, TypeVar
2626

2727
from metadata.core.connections.test_connection.check import CheckError, StepName
2828
from metadata.core.connections.test_connection.records import Diagnosis, Evidence
2929

3030
if TYPE_CHECKING:
3131
from collections.abc import Callable, Sized
3232

33+
_T = TypeVar("_T")
34+
3335

3436
# A check only needs to prove the list endpoint is reachable and returns items,
3537
# not enumerate every one, so ``fetch_list`` counts at most this many and renders
@@ -43,6 +45,13 @@ class DashboardStep(StepName):
4345

4446
CheckAccess = "CheckAccess"
4547
GetDashboards = "GetDashboards"
48+
ServerInfo = "ServerInfo"
49+
ValidateApiVersion = "ValidateApiVersion"
50+
ValidateSiteUrl = "ValidateSiteUrl"
51+
GetWorkbooks = "GetWorkbooks"
52+
GetViews = "GetViews"
53+
GetOwners = "GetOwners"
54+
GetDataModels = "GetDataModels"
4655

4756

4857
def _count(number: int, noun: str, cap: int | None = None) -> str:
@@ -72,6 +81,20 @@ def verify_access(authenticate: Callable[[], object], command: str) -> Evidence:
7281
return Evidence(summary="authenticated", command=command)
7382

7483

84+
def call_endpoint(call: Callable[[], _T], command: str) -> _T:
85+
"""Call a REST endpoint and hand its result back to the check.
86+
87+
For steps whose evidence is not a count: the check summarizes the returned
88+
value itself (an API version, a resolved owner). On failure, re-raise as
89+
``CheckError`` carrying the attempted command so the failed step still
90+
reports what it ran.
91+
"""
92+
try:
93+
return call()
94+
except Exception as cause:
95+
raise CheckError(cause, Evidence(command=command)) from cause
96+
97+
7598
def fetch_list(
7699
fetch: Callable[[], Sized | None],
77100
noun: str,

ingestion/src/metadata/ingestion/source/dashboard/tableau/client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
import math
1616
import traceback
17-
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union # noqa: UP035
17+
from typing import Dict, Iterable, List, Optional, Tuple, Union # noqa: UP035
1818

1919
import validators
20-
from cached_property import cached_property
2120
from tableauserverclient import (
2221
Pager,
2322
PersonalAccessTokenAuth,
@@ -96,9 +95,8 @@ def __init__(
9695
self.all_projects: List[ProjectItem] = [] # noqa: UP006
9796
self.ssl_manager = ssl_manager
9897

99-
@cached_property
100-
def server_info(self) -> Callable:
101-
return self.tableau_server.server_info.get
98+
def server_info(self):
99+
return self.tableau_server.server_info.get()
102100

103101
def server_api_version(self) -> str:
104102
return self.tableau_server.version

0 commit comments

Comments
 (0)