Just_UNIARC / src /database /session.py
UNI12345's picture
feat: sync backend codebase to space
feeaf83
Raw
History Blame Contribute Delete
285 Bytes
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()