Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore(docs): add missing python example (#33402)

Guilherme Souzaf6b146994ef9
diff --git a/apps/docs/content/guides/realtime.mdx b/apps/docs/content/guides/realtime.mdx
index 80cf895d32b..9d5cd5d2026 100644
--- a/apps/docs/content/guides/realtime.mdx
+++ b/apps/docs/content/guides/realtime.mdx
@@ -138,6 +138,26 @@ for await insertion in insertions {
```
</TabPanel>
+<TabPanel id="python" label="Python">
+
+```py
+# Initialize the Python client
+from supabase import create_client, Client
+
+supabase: Client = create_client(SUPABASE_URL, SUPABASE_ANON_KEY)
+
+# Create a function to handle inserts
+def handle_inserts(payload):
+ print("Change received", payload)
+
+# Listen to inserts
+await supabase.channel("todos").on_postgres_changes(
+ "INSERT", schema="public", table="todos", callback=handle_inserts
+).subscribe()
+```
+
+</TabPanel>
+
</Tabs>
Use [subscribe()](/docs/reference/javascript/subscribe) to listen to database changes.