- docker-compose.yml: timescaledb-ha (timescaledb 2.27 + vectorscale + pgvector + pgai) + backend (FastAPI, CUDA 12.1) + web (Next.js 14) - docker-compose.gpu.yml: GPU profile overlay for RTX 3070 Ti - build.bat: Windows bootstrap, auto-detects nvidia-smi and selects GPU/CPU compose - backend: Dockerfile, pyproject.toml, FastAPI skeleton with /health and /health/db - DB migration 001_init.sql: symbols (with trigram search), ohlcv_daily/1m (hypertables), macro_daily, trading_value_daily, news (vector embedding), predictions (with user_triggered flag for on-demand UX), prediction_outcomes, model_performance - web: Next.js 14 + Tailwind + lightweight-charts placeholder - README: KIS/DART/HuggingFace token issuance guides + 10 seed tickers + run instructions
31 lines
849 B
Python
31 lines
849 B
Python
from __future__ import annotations
|
|
|
|
from sqlalchemy import create_engine, text
|
|
from sqlalchemy.engine import Engine
|
|
|
|
from app.config import settings
|
|
|
|
|
|
_engine: Engine | None = None
|
|
|
|
|
|
def get_engine() -> Engine:
|
|
global _engine
|
|
if _engine is None:
|
|
_engine = create_engine(settings.database_url, pool_pre_ping=True, future=True)
|
|
return _engine
|
|
|
|
|
|
def ping() -> dict[str, object]:
|
|
"""Smoke-test: DB 연결 + 확장 확인."""
|
|
eng = get_engine()
|
|
with eng.connect() as conn:
|
|
version = conn.execute(text("SELECT version()")).scalar()
|
|
exts = conn.execute(
|
|
text(
|
|
"SELECT extname FROM pg_extension "
|
|
"WHERE extname IN ('timescaledb','vector','pg_trgm') ORDER BY extname"
|
|
)
|
|
).scalars().all()
|
|
return {"server": version, "extensions": list(exts)}
|