
- Setup project structure and FastAPI application - Configure SQLite database with SQLAlchemy ORM - Setup Alembic for database migrations - Implement user authentication with JWT - Create task models and CRUD operations - Implement task assignment functionality - Add detailed API documentation - Create comprehensive README with usage instructions - Lint code with Ruff
23 lines
512 B
Python
23 lines
512 B
Python
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from app.core.config import settings
|
|
|
|
# Create SQLAlchemy engine
|
|
engine = create_engine(
|
|
settings.SQLALCHEMY_DATABASE_URL,
|
|
connect_args={"check_same_thread": False} # Only needed for SQLite
|
|
)
|
|
|
|
# Create sessionmaker
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
|
|
|
|
# Dependency for getting DB session
|
|
def get_db():
|
|
db = SessionLocal()
|
|
try:
|
|
yield db
|
|
finally:
|
|
db.close()
|