https://github.com/supabase/postgrest-py
PostgREST client for Python. This library provides an ORM interface to PostgREST
https://github.com/supabase/postgrest-py
community postgrest python supabase
Last synced: 1 day ago
JSON representation
PostgREST client for Python. This library provides an ORM interface to PostgREST
- Host: GitHub
- URL: https://github.com/supabase/postgrest-py
- Owner: supabase
- License: mit
- Created: 2020-05-14T02:18:24.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T14:36:47.000Z (6 days ago)
- Last Synced: 2025-04-09T19:24:09.644Z (5 days ago)
- Topics: community, postgrest, python, supabase
- Language: Python
- Homepage: https://postgrest-py.readthedocs.io
- Size: 1.13 MB
- Stars: 274
- Watchers: 13
- Forks: 54
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- jimsghstars - supabase/postgrest-py - PostgREST client for Python. This library provides an ORM interface to PostgREST (Python)
README
# postgrest-py
[PostgREST](https://postgrest.org) client for Python. This library provides an "ORM-like" interface to PostgREST.
## INSTALLATION
### Requirements
- Python >= 3.9
- 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.
```sh
docker-compose up
```Once Docker Compose started, PostgREST is accessible at .
### Instructions
#### With Poetry (recommended)
```sh
poetry add postgrest
```#### With Pip
```sh
pip install postgrest
```## USAGE
### Getting started
```py
import asyncio
from postgrest import AsyncPostgrestClientasync def main():
async with AsyncPostgrestClient("http://localhost:3000") as client:
r = await client.from_("countries").select("*").execute()
countries = r.dataasyncio.run(main())
```### Create
```py
await client.from_("countries").insert({ "name": "Việt Nam", "capital": "Hà Nội" }).execute()
```### Read
```py
r = await client.from_("countries").select("id", "name").execute()
countries = r.data
```### Update
```py
await client.from_("countries").update({"capital": "Hà Nội"}).eq("name", "Việt Nam").execute()
```### Delete
```py
await client.from_("countries").delete().eq("name", "Việt Nam").execute()
```### General filters
### Stored procedures (RPC)
```py
await client.rpc("foobar", {"arg1": "value1", "arg2": "value2"}).execute()
```## DEVELOPMENT
```sh
git clone https://github.com/supabase/postgrest-py.git
cd postgrest-py
poetry install
poetry run pre-commit install
```### Testing
```sh
poetry run pytest
```## CHANGELOG
Read more [here](https://github.com/supabase/postgrest-py/blob/main/CHANGELOG.md).
## SPONSORS
We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.
[](https://www.worklife.vc)
[](https://github.com/sponsors/supabase)