
- Add SQLite database configuration - Create Todo model, schemas, and CRUD operations - Implement Todo API endpoints - Add Alembic migration for todo table - Set up database initialization in main.py - Update README with project details and instructions - Add pyproject.toml with Ruff configuration
14 lines
254 B
Python
14 lines
254 B
Python
from collections.abc 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() |