From b5ade7496e8b0a8e013ee593ffcb781b838df5e5 Mon Sep 17 00:00:00 2001 From: Paul Bennett Date: Thu, 20 Jul 2023 14:54:54 +0100 Subject: [PATCH] Update README.md Adding `upsert` into Readme --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index c4808759..8e3e8447 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,24 @@ supabase: Client = create_client(url, key) data = supabase.table("countries").update({"country": "Indonesia", "capital_city": "Jakarta"}).eq("id", 1).execute() ``` +### Update data of duplicate keys + +```python +from supabase import create_client, Client + +url: str = os.environ.get("SUPABASE_TEST_URL") +key: str = os.environ.get("SUPABASE_TEST_KEY") +supabase: Client = create_client(url, key) + +country = { + "country": "United Kingdom", + "capital_city": "London" # this was missing when it was added +} + +data = supabase.table("countries").upsert(country).execute() +assert len(data.data) > 0 +``` + ### Deletion of Data ```python