Automated Action aeab17a8ea Implement Task Manager API with FastAPI and SQLite
- Set up project structure
- Created Task model with SQLAlchemy
- Implemented SQLite database connection
- Created Alembic migrations
- Added Task CRUD endpoints
- Added health endpoint
- Updated README with project details

generated with BackendIM... (backend.im)
2025-05-14 07:18:59 +00:00

18 lines
399 B
Python

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():
db = SessionLocal()
try:
yield db
finally:
db.close()