Spaces:
Sleeping
Sleeping
File size: 285 Bytes
feeaf83 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from sqlalchemy.orm import Session
from src.database.models import SessionLocal
def get_db():
"""
Dependency to get a database session.
Used by FastAPI routes for automated cleanup.
"""
db = SessionLocal()
try:
yield db
finally:
db.close()
|