fix(core): restore adapter command behavior
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Direct PostgreSQL implementation of the DWH port."""
|
||||
|
||||
from tht.config import DatabaseConfig
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.exc import OperationalError, SQLAlchemyError
|
||||
|
||||
from tht.db import execute, sampling
|
||||
from tht.db.connection import can_create_in_schema, make_engine, ping, writable_tables
|
||||
@@ -22,8 +22,10 @@ class PostgresDwhAdapter:
|
||||
def health(self) -> DwhHealth:
|
||||
try:
|
||||
ping(self._engine)
|
||||
except OperationalError as exc:
|
||||
return DwhHealth(ok=False, detail=str(exc.orig), error_kind="connection")
|
||||
except SQLAlchemyError as exc:
|
||||
return DwhHealth(ok=False, detail=str(exc))
|
||||
return DwhHealth(ok=False, detail=str(exc), error_kind="connection")
|
||||
writable = tuple(writable_tables(self._engine, self._config.db_schema))
|
||||
can_create = can_create_in_schema(self._engine, self._config.db_schema)
|
||||
return DwhHealth(ok=True, database=self._config.database, schema=self._config.db_schema,
|
||||
|
||||
Reference in New Issue
Block a user