mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
chore: update pg changes to add python to the code blocks (#47793)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Adds code blocks for Python and new pg changes features <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated Python code examples for Realtime Postgres Changes to use cleaner, working subscription syntax. * Fixed a missing comma in a multi-change example so the sample code is valid. * Added a missing Python example for selecting specific columns. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Ali Waseem <waseema393@gmail.com>
This commit is contained in:
1 parent
0791b04eb8
commit
4a9b5a538b
1 file changed
+37
-43
@@ -310,8 +310,7 @@ changes = supabase.channel('schema-db-changes').on_postgres_changes(
|
||||
"*",
|
||||
schema="public",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -681,8 +680,7 @@ changes = supabase.channel('schema-db-changes').on_postgres_changes(
|
||||
"INSERT",
|
||||
schema="public",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -693,8 +691,7 @@ changes = supabase.channel('schema-db-changes').on_postgres_changes(
|
||||
"UPDATE",
|
||||
schema="public",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -705,8 +702,7 @@ changes = supabase.channel('schema-db-changes').on_postgres_changes(
|
||||
"DELETE",
|
||||
schema="public",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -717,8 +713,7 @@ changes = supabase.channel('schema-db-changes').on_postgres_changes(
|
||||
"*",
|
||||
schema="public",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -903,8 +898,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
schema="public",
|
||||
table="todos",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -1026,7 +1020,7 @@ myChannel.subscribe()
|
||||
changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
"*",
|
||||
schema="public",
|
||||
table="messages"
|
||||
table="messages",
|
||||
callback=lambda payload: print(payload)
|
||||
).on_postgres_changes(
|
||||
"INSERT",
|
||||
@@ -1162,8 +1156,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="todos",
|
||||
filter="id=eq.1",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -1360,8 +1353,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="messages",
|
||||
filter="body=eq.hey",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -1524,8 +1516,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="messages",
|
||||
filter="body=neq.bye",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -1687,8 +1678,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="profiles",
|
||||
filter="age=lt.65",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -1850,8 +1840,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="profiles",
|
||||
filter="age=lte.65",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -2013,8 +2002,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="products",
|
||||
filter="quantity=gt.10",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -2176,8 +2164,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="products",
|
||||
filter="quantity=gte.10",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -2339,8 +2326,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="products",
|
||||
filter="name=in.(red,blue,yellow)",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -2503,8 +2489,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="articles",
|
||||
filter="title=ilike.%breaking%",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -2667,8 +2652,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="posts",
|
||||
filter="slug=match.^post-\\d+$",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -2831,8 +2815,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="todos",
|
||||
filter="completed_at=is.null",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -2995,8 +2978,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="orders",
|
||||
filter="status=isdistinct.shipped",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -3158,8 +3140,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="posts",
|
||||
filter="status=not.in.(draft,archived)",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -3332,8 +3313,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="orders",
|
||||
filter="amount=gt.100,status=eq.open",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
@@ -3428,6 +3408,21 @@ let changes = await myChannel.postgresChange(
|
||||
await myChannel.subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
</$Show>
|
||||
<$Show if="sdk:python">
|
||||
<TabPanel id="python" label="Python">
|
||||
|
||||
```python
|
||||
changes = supabase.channel('changes').on_postgres_changes(
|
||||
"*",
|
||||
schema="public",
|
||||
table="profiles",
|
||||
select=["id", "username"],
|
||||
callback=lambda payload: print(payload)
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
</$Show>
|
||||
</Tabs>
|
||||
@@ -3595,8 +3590,7 @@ changes = supabase.channel('db-changes').on_postgres_changes(
|
||||
table="products",
|
||||
filter="name=in.(red,blue,yellow)",
|
||||
callback=lambda payload: print(payload)
|
||||
)
|
||||
.subscribe()
|
||||
).subscribe()
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
|
||||
Reference in new issue
Block a user