From 6846c763f2582464b6ca94dfa4c1b3b96a5134f5 Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Mon, 4 Aug 2025 14:33:03 +0200 Subject: [PATCH] apparently engine.begin() does not need to be awaited --- src/suou/__init__.py | 2 +- src/suou/sqlalchemy_async.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/suou/__init__.py b/src/suou/__init__.py index 9108eac..ceeb709 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -33,7 +33,7 @@ from .strtools import PrefixIdentifier from .validators import matches from .redact import redact_url_password -__version__ = "0.5.0-dev30" +__version__ = "0.5.0-dev31" __all__ = ( 'ConfigOptions', 'ConfigParserConfigSource', 'ConfigSource', 'ConfigValue', diff --git a/src/suou/sqlalchemy_async.py b/src/suou/sqlalchemy_async.py index cd082b8..42045fc 100644 --- a/src/suou/sqlalchemy_async.py +++ b/src/suou/sqlalchemy_async.py @@ -41,8 +41,9 @@ class SQLAlchemy: async def begin(self) -> AsyncSession: if self.engine is None: raise RuntimeError('database is not connected') - return await self.engine.begin() - __aenter__ = begin + return self.engine.begin() + async def __aenter__(self): + return self.begin() async def __aexit__(self, e1, e2, e3): return await self.engine.__aexit__(e1, e2, e3) async def paginate(self, select: Select, *,