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.