PostgREST client for Python. This library provides an ORM interface to PostgREST.
Actively maintained. Last release 3 weeks ago, commits in 21 of the last 26 weeks. A safe choice.
pip install postgrestpostgrest-py
PostgREST client for Python. This library provides an "ORM-like" interface to PostgREST.
INSTALLATION
Requirements
- Python >= 3.11
- PostgreSQL >= 13
- PostgREST >= 11
Local PostgREST server
If you want to use a local PostgREST server for development, you can use our preconfigured instance via Docker Compose.
docker-compose up
Once Docker Compose started, PostgREST is accessible at http://localhost:3000.
Instructions
With uv (recommended)
uv add postgrest
With Pip
pip install postgrest
Supabase Service Compatibility
postgrest only guarantees compatibility with the latest PostgREST release. Older PostgREST releases are supported on a best-effort basis, but compatibility is not guaranteed.
If you self-host PostgREST, we recommend upgrading to the latest release when upgrading this SDK.
USAGE
Getting started
import asyncio
from postgrest import AsyncPostgrestClient
async def main():
async with AsyncPostgrestClient("http://localhost:3000") as client:
r = await client.from_("countries").select("*").execute()
countries = r.data
asyncio.run(main())
Create
await client.from_("countries").insert({ "name": "Việt Nam", "capital": "Hà Nội" }).execute()
Read
r = await client.from_("countries").select("id", "name").execute()
countries = r.data
Update
await client.from_("countries").update({"capital": "Hà Nội"}).eq("name", "Việt Nam").execute()
Delete
await client.from_("countries").delete().eq("name", "Việt Nam").execute()
General filters
Stored procedures (RPC)
await client.rpc("foobar", {"arg1": "value1", "arg2": "value2"}).execute()
CHANGELOG
Read more here.

