mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-05 15:48:03 +00:00
Fix: Postgres usage not terminating with bad connection (#19707)
* postgres usage not terminating with bad connection * Added Operational error --------- Co-authored-by: Akash Verma <akashverma@Akashs-MacBook-Pro-2.local>
This commit is contained in:
parent
372953fc88
commit
fcbe9241bc
@ -15,6 +15,11 @@ import traceback
|
||||
from datetime import datetime
|
||||
from typing import Iterable
|
||||
|
||||
from sqlalchemy.exc import OperationalError
|
||||
|
||||
from metadata.generated.schema.entity.services.ingestionPipelines.status import (
|
||||
StackTraceError,
|
||||
)
|
||||
from metadata.generated.schema.type.basic import DateTime
|
||||
from metadata.generated.schema.type.tableQuery import TableQueries, TableQuery
|
||||
from metadata.ingestion.source.connections import get_connection
|
||||
@ -67,6 +72,16 @@ class PostgresUsageSource(PostgresQueryParserSource, UsageSource):
|
||||
logger.error(str(err))
|
||||
if queries:
|
||||
yield TableQueries(queries=queries)
|
||||
|
||||
except OperationalError as err:
|
||||
self.status.failed(
|
||||
StackTraceError(
|
||||
name="Usage",
|
||||
error=f"Source Usage failed due to - {err}",
|
||||
stackTrace=traceback.format_exc(),
|
||||
)
|
||||
)
|
||||
|
||||
except Exception as err:
|
||||
if query:
|
||||
logger.debug(
|
||||
|
Loading…
x
Reference in New Issue
Block a user