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-3.0.0a1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

postgrest-3.0.0a1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file postgrest-3.0.0a1.tar.gz.

File metadata

  • Download URL: postgrest-3.0.0a1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for postgrest-3.0.0a1.tar.gz
Algorithm Hash digest
SHA256 3a3d84ff1a7d300485026ef54667716bc62fe79a6ae3c53ead71e45240043876
MD5 b066713033fe42291a38840f9256d082
BLAKE2b-256 c81b9fe5367409385ddef13f5ffb114dcdee9c7b3ffcc33f54f0af267c669a53

See more details on using hashes here.

File details

Details for the file postgrest-3.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: postgrest-3.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for postgrest-3.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 310c177efd151191b631c92090126fc24367ee1c8d167f0f2a2781d8a8bb7803
MD5 7b4245d1e522ae48fbd851e374b85da5
BLAKE2b-256 6707c6f9a08d2a42c3e7e7e68b4609bce2e79d52cfa1e5f4429b4989807ba395

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