Automated Action 97c3923628 Build complete task management tool with FastAPI and SQLite
- Implemented CRUD operations for task management
- Added task status tracking (pending, in_progress, completed)
- Included priority levels (low, medium, high)
- Set up SQLite database with Alembic migrations
- Added filtering and pagination support
- Configured CORS for all origins
- Included health check endpoint
- Added comprehensive API documentation
- Formatted code with Ruff linting
2025-06-19 05:20:58 +00:00

23 lines
510 B
Python

from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
DB_DIR = Path("/app/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)
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()