Automated Action 4bbc49f04d Create a FastAPI REST API service with SQLite database
- Set up project structure
- Configure SQLite database with SQLAlchemy
- Create item model and schema
- Set up Alembic for database migrations
- Implement CRUD operations for items
- Add health check endpoint
- Add API documentation
- Configure Ruff for linting
- Update README with project information
2025-05-23 09:14:12 +00:00

14 lines
245 B
Python

from typing import Generator
from app.db.session import SessionLocal
def get_db() -> Generator:
"""
Dependency for getting the database session.
"""
db = SessionLocal()
try:
yield db
finally:
db.close()