Automated Action 53bc4e0199 Implement Task Manager API
- Set up FastAPI application structure
- Create Task model with SQLAlchemy
- Implement CRUD operations for tasks
- Add API endpoints for tasks with filtering options
- Configure Alembic for database migrations
- Add health check endpoint
- Configure Ruff for linting
- Add comprehensive documentation in README.md
2025-06-10 14:48:01 +00:00

20 lines
472 B
Python

"""Database session and engine setup."""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_engine(
settings.SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
def get_db():
"""Get database session."""
db = SessionLocal()
try:
yield db
finally:
db.close()