aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/postgrest-0.19.3.dist-info/METADATA
blob: 824dee1e7523bf14386379e6494e7b861e4192ee (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Metadata-Version: 2.1
Name: postgrest
Version: 0.19.3
Summary: PostgREST client for Python. This library provides an ORM interface to PostgREST.
Home-page: https://github.com/supabase/postgrest-py
License: MIT
Author: Lương Quang Mạnh
Author-email: luongquangmanh85@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: deprecation (>=2.1.0,<3.0.0)
Requires-Dist: httpx[http2] (>=0.26,<0.29)
Requires-Dist: pydantic (>=1.9,<3.0)
Requires-Dist: strenum (>=0.4.9,<0.5.0) ; python_version < "3.11"
Project-URL: Documentation, https://postgrest-py.rtfd.io
Project-URL: Repository, https://github.com/supabase/postgrest-py
Description-Content-Type: text/markdown

# 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)