
Implemented a complete FastAPI backend with: - Project structure with FastAPI and SQLAlchemy - SQLite database with proper configuration - Alembic for database migrations - Generic Item resource with CRUD operations - REST API endpoints with proper validation - Health check endpoint - Documentation and setup instructions
13 lines
186 B
Python
13 lines
186 B
Python
from typing import Generator
|
|
|
|
|
|
from app.db.session import SessionLocal
|
|
|
|
|
|
def get_db() -> Generator:
|
|
try:
|
|
db = SessionLocal()
|
|
yield db
|
|
finally:
|
|
db.close()
|