File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
packages/service-library/src/servicelib/fastapi Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 55from simcore_postgres_database .utils_aiosqlalchemy import ( # type: ignore[import-not-found] # this on is unclear
66 get_pg_engine_stateinfo ,
77)
8+ from sqlalchemy .ext .asyncio import AsyncEngine
89
910from ..db_asyncpg_utils import create_async_engine_and_pg_database_ready
1011from ..logging_utils import log_context
@@ -31,3 +32,8 @@ async def close_db_connection(app: FastAPI) -> None:
3132 with log_context (_logger , logging .DEBUG , f"db disconnect of { app .state .engine } " ):
3233 if engine := app .state .engine :
3334 await engine .dispose ()
35+
36+
37+ def get_engine (app : FastAPI ) -> AsyncEngine :
38+ assert isinstance (app .state .engine , AsyncEngine ) # nosec
39+ return app .state .engine
You can’t perform that action at this time.
0 commit comments