Skip to main content

PostgREST client for Python. This library provides an ORM interface to PostgREST.

Project description

postgrest-py

PostgREST 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.

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

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.

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.

Worklife VC New Sponsor

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postgrest-2.29.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

postgrest-2.29.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file postgrest-2.29.0.tar.gz.

File metadata

  • Download URL: postgrest-2.29.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.2

File hashes

Hashes for postgrest-2.29.0.tar.gz
Algorithm Hash digest
SHA256 a87081858f627fcd57e8e7137004a1ef0adbdf0dbdfed1384e9ea1d7a9c525ec
MD5 a795948f51d404755027b6947e5ca60f
BLAKE2b-256 5298f216b8b5c4d116ab6a2fb21339b5821da279ee773e163612418e1c56c012

See more details on using hashes here.

File details

Details for the file postgrest-2.29.0-py3-none-any.whl.

File metadata

  • Download URL: postgrest-2.29.0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.2

File hashes

Hashes for postgrest-2.29.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ee48e146f726272733d20e2b12de354cdb6cb9dd9cc3a61ed97ce69047aeb96
MD5 e2f0eb9f1144df3b7c3ac17e206b07c7
BLAKE2b-256 2c0b08b670a93a90d625c557b9e64b8a5fdeec80c3542d2d0265f0b4d6b16646

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page