(self)
| 32 | |
| 33 | @asynccontextmanager |
| 34 | async def session(self) -> AsyncGenerator[AsyncSession]: |
| 35 | async with self.async_session_factory() as session: |
| 36 | try: |
| 37 | yield session |
| 38 | await session.commit() |
| 39 | except Exception: |
| 40 | await session.rollback() |
| 41 | raise |
| 42 | finally: |
| 43 | await session.close() |
| 44 | |
| 45 | async def close(self) -> None: |
| 46 | if self.engine is not None: |