2025-05-17 02:53:13 +00:00

17 lines
296 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 to get a database session.
"""
db = SessionLocal()
try:
yield db
finally:
db.close()