The backend component to interface with the smart contract.
25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- from typing import AsyncGenerator
- from sqlalchemy.exc import SQLAlchemyError
- from sqlalchemy.ext.asyncio import AsyncSession
-
- from app.db.base import AsyncSessionLocal
-
-
- async def get_db_session() -> AsyncGenerator[AsyncSession, None]:
- async with AsyncSessionLocal() as session:
- try:
- yield session
- await session.commit()
- except SQLAlchemyError as e:
- await session.rollback()
- raise
- finally:
- await session.close()
|