Barclays-banner-builder/backend/app/database.py
Vadym Samoilenko 735b2ef141 Add full Sprint 0+1 implementation: Docker, FastAPI, React, RAG, deploy
- Backend: FastAPI + SQLAlchemy async, pgvector RAG, RQ workers, OpenAI gpt-5.4-mini structured output
- Frontend: React 18 + Vite + TypeScript + TailwindCSS + shadcn/ui, job polling pattern (no WebSocket)
- Admin panel: editable SystemPrompt with version history for FCA audit trail
- Deploy: idempotent deploy.sh with hash-based cache, Apache Include fragment, alembic migrations
- Docker: dev + prod compose configs, port 8010 (API) to avoid OliVAS conflict on host

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 12:01:42 +01:00

27 lines
612 B
Python

from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from sqlalchemy.orm import DeclarativeBase
from app.config import get_settings
class Base(DeclarativeBase):
pass
def create_engine():
settings = get_settings()
return create_async_engine(
settings.database_url,
pool_size=5,
max_overflow=10,
echo=settings.is_dev,
)
engine = create_engine()
AsyncSessionLocal = async_sessionmaker(engine, expire_on_commit=False)
async def get_db() -> AsyncSession:
async with AsyncSessionLocal() as session:
yield session