postgrest


Namepostgrest JSON
Version 0.19.0 PyPI version JSON
download
home_pagehttps://github.com/supabase/postgrest-py
SummaryPostgREST client for Python. This library provides an ORM interface to PostgREST.
upload_time2024-11-22 22:12:08
maintainerNone
docs_urlNone
authorLương Quang Mạnh
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 <http://localhost:3000>.

### Instructions

#### With Poetry (recommended)

```sh
poetry add postgrest
```

#### With Pip

```sh
pip install postgrest
```

## USAGE

### Getting started

```py
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

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

[![Worklife VC](https://user-images.githubusercontent.com/10214025/90451355-34d71200-e11e-11ea-81f9-1592fd1e9146.png)](https://www.worklife.vc)
[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/supabase/postgrest-py",
    "name": "postgrest",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "L\u01b0\u01a1ng Quang M\u1ea1nh",
    "author_email": "luongquangmanh85@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6c/46/ab0a8b316e85d6069ca6964a1f279561562e16b9b5362f7fda6e58760531/postgrest-0.19.0.tar.gz",
    "platform": null,
    "description": "# postgrest-py\n\n[PostgREST](https://postgrest.org) client for Python. This library provides an \"ORM-like\" interface to PostgREST.\n\n## INSTALLATION\n\n### Requirements\n\n- Python >= 3.9\n- PostgreSQL >= 13\n- PostgREST >= 11\n\n### Local PostgREST server\n\nIf you want to use a local PostgREST server for development, you can use our preconfigured instance via Docker Compose.\n\n```sh\ndocker-compose up\n```\n\nOnce Docker Compose started, PostgREST is accessible at <http://localhost:3000>.\n\n### Instructions\n\n#### With Poetry (recommended)\n\n```sh\npoetry add postgrest\n```\n\n#### With Pip\n\n```sh\npip install postgrest\n```\n\n## USAGE\n\n### Getting started\n\n```py\nimport asyncio\nfrom postgrest import AsyncPostgrestClient\n\nasync def main():\n    async with AsyncPostgrestClient(\"http://localhost:3000\") as client:\n        r = await client.from_(\"countries\").select(\"*\").execute()\n        countries = r.data\n\nasyncio.run(main())\n```\n\n### Create\n\n```py\nawait client.from_(\"countries\").insert({ \"name\": \"Vi\u1ec7t Nam\", \"capital\": \"H\u00e0 N\u1ed9i\" }).execute()\n```\n\n### Read\n\n```py\nr = await client.from_(\"countries\").select(\"id\", \"name\").execute()\ncountries = r.data\n```\n\n### Update\n\n```py\nawait client.from_(\"countries\").update({\"capital\": \"H\u00e0 N\u1ed9i\"}).eq(\"name\", \"Vi\u1ec7t Nam\").execute()\n```\n\n### Delete\n\n```py\nawait client.from_(\"countries\").delete().eq(\"name\", \"Vi\u1ec7t Nam\").execute()\n```\n\n### General filters\n\n### Stored procedures (RPC)\n```py\nawait client.rpc(\"foobar\", {\"arg1\": \"value1\", \"arg2\": \"value2\"}).execute()\n```\n\n## DEVELOPMENT\n\n```sh\ngit clone https://github.com/supabase/postgrest-py.git\ncd postgrest-py\npoetry install\npoetry run pre-commit install\n```\n\n### Testing\n\n```sh\npoetry run pytest\n```\n\n## CHANGELOG\n\nRead more [here](https://github.com/supabase/postgrest-py/blob/main/CHANGELOG.md).\n\n## SPONSORS\n\nWe are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don\u2019t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.\n\n[![Worklife VC](https://user-images.githubusercontent.com/10214025/90451355-34d71200-e11e-11ea-81f9-1592fd1e9146.png)](https://www.worklife.vc)\n[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PostgREST client for Python. This library provides an ORM interface to PostgREST.",
    "version": "0.19.0",
    "project_urls": {
        "Documentation": "https://postgrest-py.rtfd.io",
        "Homepage": "https://github.com/supabase/postgrest-py",
        "Repository": "https://github.com/supabase/postgrest-py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10fa0fc8d4d5249ed62b52a9e286cee9edb0616769935628cc01a1e523052254",
                "md5": "0cd892270939dac138a088752bb56d24",
                "sha256": "94a91edff4e3004befed156fc603032d1ed3b9f5fce1ae5eaba946df413d69e1"
            },
            "downloads": -1,
            "filename": "postgrest-0.19.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0cd892270939dac138a088752bb56d24",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 22121,
            "upload_time": "2024-11-22T22:12:06",
            "upload_time_iso_8601": "2024-11-22T22:12:06.645552Z",
            "url": "https://files.pythonhosted.org/packages/10/fa/0fc8d4d5249ed62b52a9e286cee9edb0616769935628cc01a1e523052254/postgrest-0.19.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c46ab0a8b316e85d6069ca6964a1f279561562e16b9b5362f7fda6e58760531",
                "md5": "b43527f2faa00947bb8691562c23d364",
                "sha256": "a66714e21219e135e744eaf61031b28e2a11f7c4fe40bf60cb8f6d8b68c7e12b"
            },
            "downloads": -1,
            "filename": "postgrest-0.19.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b43527f2faa00947bb8691562c23d364",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 15022,
            "upload_time": "2024-11-22T22:12:08",
            "upload_time_iso_8601": "2024-11-22T22:12:08.669034Z",
            "url": "https://files.pythonhosted.org/packages/6c/46/ab0a8b316e85d6069ca6964a1f279561562e16b9b5362f7fda6e58760531/postgrest-0.19.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-22 22:12:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "supabase",
    "github_project": "postgrest-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "postgrest"
}
        
Elapsed time: 0.39482s