The Python table helpers cover common read paths without hand-writing every select and count.
Read rows
from relpin_sdk import RelpinDb, fetch_table_rows
async def list_open_orders() -> dict[str, object]:
with RelpinDb() as db:
rows = await fetch_table_rows(
db,
"orders",
columns=["id", "name", "status"],
where={"status": "open"},
order_by=[("created_at", "desc"), "id"],
limit=50,
)
return {"orders": rows}
Count rows
from relpin_sdk import count_table_rows
total = await count_table_rows(db, "orders", where={"status": "open"})
Safety rules
Identifiers are validated and quoted. Values travel as bind parameters. Invalid identifiers, order directions, or negative paging fail before a query runs.
Use raw SQL on the same governed transport when you need joins, aggregates, or a shape the helpers do not cover.