From dbf85f5369def04864be4430e77db6c34c35e39e Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Mon, 4 Aug 2025 14:43:06 +0200 Subject: [PATCH] make it work --- src/suou/sqlalchemy_async.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/suou/sqlalchemy_async.py b/src/suou/sqlalchemy_async.py index e7af810..1079f6b 100644 --- a/src/suou/sqlalchemy_async.py +++ b/src/suou/sqlalchemy_async.py @@ -14,6 +14,12 @@ This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. """ +from contextlib import _GeneratorContextManager + + +from sqlalchemy.engine.base import Connection + + from __future__ import annotations from sqlalchemy import Engine, Select, func, select from sqlalchemy.orm import DeclarativeBase, lazyload @@ -44,7 +50,7 @@ class SQLAlchemy: if self.engine is None: raise RuntimeError('database is not connected') ## XXX is it accurate? - s = self.engine.begin() + s = AsyncSession(self.engine) self._sessions.append(s) return s async def __aenter__(self) -> AsyncSession: