Automated Action 0cd6e6441d Setup FastAPI REST API for Sports Betting Verification
- Set up FastAPI application structure
- Implemented SQLite database integration with SQLAlchemy
- Added Alembic migrations for database versioning
- Created bet model and API endpoints for CRUD operations
- Added comprehensive README with setup and usage instructions
- Added health check endpoint and CORS support
2025-06-07 13:06:19 +00:00

18 lines
403 B
Python

from typing import Generator
from sqlalchemy.orm import Session
from app.db.session import SessionLocal
def get_db() -> Generator[Session, None, None]:
"""
Dependency function for getting a database session.
Yields a database session that is automatically closed when the request is finished.
"""
db = SessionLocal()
try:
yield db
finally:
db.close()