Spaces:
Runtime error
Runtime error
Download app/database/base.py from Zlovoblachko/helpy_botik: direct link, hf CLI and curl.
- Browser
- Download file 398 Bytes
-
https://huggingface.co/spaces/Zlovoblachko/helpy_botik/resolve/main/app/database/base.py
- Command line
-
hf download hf://spaces/Zlovoblachko/helpy_botik/app/database/base.py
-
curl -L -o base.py https://huggingface.co/spaces/Zlovoblachko/helpy_botik/resolve/main/app/database/base.py
398 Bytes
| from contextlib import asynccontextmanager | |
| from .models import async_session | |
| async def get_session(): | |
| """Provide a transactional scope around a series of operations.""" | |
| session = async_session() | |
| try: | |
| yield session | |
| await session.commit() | |
| except Exception: | |
| await session.rollback() | |
| raise | |
| finally: | |
| await session.close() |