mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-15 20:20:55 +00:00
fix tableau connector when it cannot connect to URI (#4451)
This commit is contained in:
parent
89a8fa05eb
commit
bf35d4c83e
@ -120,6 +120,7 @@ class TableauSource(Source):
|
|||||||
|
|
||||||
self.config = config
|
self.config = config
|
||||||
self.report = SourceReport()
|
self.report = SourceReport()
|
||||||
|
self.server = None
|
||||||
# This list keeps track of datasource being actively used by workbooks so that we only retrieve those
|
# This list keeps track of datasource being actively used by workbooks so that we only retrieve those
|
||||||
# when emitting published data sources.
|
# when emitting published data sources.
|
||||||
self.datasource_ids_being_used: List[str] = []
|
self.datasource_ids_being_used: List[str] = []
|
||||||
@ -130,6 +131,7 @@ class TableauSource(Source):
|
|||||||
self._authenticate()
|
self._authenticate()
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
|
if self.server is not None:
|
||||||
self.server.auth.sign_out()
|
self.server.auth.sign_out()
|
||||||
|
|
||||||
def _authenticate(self):
|
def _authenticate(self):
|
||||||
@ -154,11 +156,13 @@ class TableauSource(Source):
|
|||||||
self.server = Server(self.config.connect_uri, use_server_version=True)
|
self.server = Server(self.config.connect_uri, use_server_version=True)
|
||||||
self.server.auth.sign_in(authentication)
|
self.server.auth.sign_in(authentication)
|
||||||
except ServerResponseError as e:
|
except ServerResponseError as e:
|
||||||
|
logger.error(e)
|
||||||
self.report.report_failure(
|
self.report.report_failure(
|
||||||
key="tableau-login",
|
key="tableau-login",
|
||||||
reason=f"Unable to Login with credentials provided" f"Reason: {str(e)}",
|
reason=f"Unable to Login with credentials provided" f"Reason: {str(e)}",
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
self.report.report_failure(
|
self.report.report_failure(
|
||||||
key="tableau-login", reason=f"Unable to Login" f"Reason: {str(e)}"
|
key="tableau-login", reason=f"Unable to Login" f"Reason: {str(e)}"
|
||||||
)
|
)
|
||||||
@ -925,6 +929,8 @@ class TableauSource(Source):
|
|||||||
return cls(ctx, config)
|
return cls(ctx, config)
|
||||||
|
|
||||||
def get_workunits(self) -> Iterable[MetadataWorkUnit]:
|
def get_workunits(self) -> Iterable[MetadataWorkUnit]:
|
||||||
|
if self.server is None:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
yield from self.emit_workbooks(self.config.workbooks_page_size)
|
yield from self.emit_workbooks(self.config.workbooks_page_size)
|
||||||
if self.datasource_ids_being_used:
|
if self.datasource_ids_being_used:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user