Automated Action b0d71975a9 Create simple Todo application with FastAPI and SQLite
- Set up project structure with FastAPI and SQLite
- Created Todo model and database schemas
- Implemented CRUD operations for Todo items
- Added Alembic for database migrations
- Added health check endpoint
- Used Ruff for code linting and formatting
- Updated README with project documentation
2025-05-17 13:05:20 +00:00

24 lines
535 B
Python

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_engine(
settings.SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}, # SQLite specific
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
# Dependency to get DB session
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()