선적 서류 비치

Build a Python FastAPI app

Create a FastAPI app that uses the governed Python SDK and preview readiness path.

베타 업데이트됨 2026-06-11 원시 마크다운
문서 내용은 현재 영어로 게시되어 있습니다. 번역이 준비되는 동안 한국어 문서 경로를 탐색할 수 있습니다.
문서 트리

Relpin supports Python FastAPI apps during open beta. The Python SDK gives the app a governed database path and a preview readiness signal.

Create from a Python starter

Start with a Python or FastAPI template in Studio. The template includes the SDK wiring Relpin expects for preview and publish.

Add readiness middleware

FastAPI preview uses a readiness endpoint owned by the SDK middleware.

from fastapi import FastAPI
from relpin_sdk import RelpinReadinessMiddleware

app = FastAPI()
app.add_middleware(RelpinReadinessMiddleware)

The middleware responds on /__relpin/ready. The preview sidecar uses that signal to decide when the app can receive traffic.

Query governed data

Use RelpinDb for data access. The app sends queries over the governed transport; it does not read a raw database connection string.

from relpin_sdk import RelpinDb

async def list_orders() -> dict[str, object]:
    with RelpinDb() as db:
        rows = await db.fetch_all_async("select id, status from orders limit 20")
    return {"orders": rows}

Prefer helpers for simple tables

For simple table reads, use the table helpers documented in Python table helpers. Drop down to SQL when you need joins or aggregates.