Automated Action 3bed1d0510 Create Todo API with FastAPI and SQLite
- Implement Todo CRUD API endpoints
- Set up SQLite database with SQLAlchemy
- Create Todo model and schemas
- Configure Alembic migrations
- Add comprehensive documentation

🤖 Generated with and Co-Authored by [BackendIM](https://backend.im)
2025-05-11 18:30:32 +00:00

17 lines
463 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
# Create DB directory
DB_DIR = settings.BASE_DIR / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"
engine = create_engine(
SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)