Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /gavincui1026_Fastapi-Backend /backend /src /api /dependencies /session.py
| import contextlib | |
| import typing | |
| import fastapi | |
| from sqlalchemy.ext.asyncio import ( | |
| async_sessionmaker as sqlalchemy_async_sessionmaker, | |
| AsyncSession as SQLAlchemyAsyncSession, | |
| AsyncSessionTransaction as SQLAlchemyAsyncSessionTransaction, | |
| ) | |
| from src.repository.database import async_db | |
| async def get_async_session() -> typing.AsyncGenerator[SQLAlchemyAsyncSession, None]: | |
| try: | |
| yield async_db.async_session | |
| except Exception as e: | |
| print(e) | |
| await async_db.async_session.rollback() | |
| finally: | |
| await async_db.async_session.close() | |
Xet Storage Details
- Size:
- 584 Bytes
- Xet hash:
- 74d22e32af98594177b12a82fbc7cf706e0137d4870887c5d1a80a89738574eb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.