Upsert with Python client not updating table
This seems a very simple challenge, but I'm stumped.
I'm trying to update a database with data from Google Analytics periodically. I'm using the Python client and upsert. Even with a basic single line, it does not seem to be updating the table. Table definition is:
create table
public.users_by_day (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
"pagePath" text not null,
date date not null,
"totalUsers" bigint not null,
constraint users_by_day_pkey primary key ("pagePath", date)
) tablespace pg_default;
My code is:
from supabase import create_client, Client
url: str = 'https://{id}.supabase.co'
key: str = '{key}'
supabase: Client = create_client(url, key)
response = supabase.table("users_by_day").upsert('[{"pagePath": "/tags/thing", "date": "2023-12-21", "totalUsers": 434}]').execute()
print(response)
Printed to the terminal is:
2024-01-05 15:07:39,210:INFO - HTTP Request: POST https://**************************.supabase.co/rest/v1/users_by_day "HTTP/1.1 200 OK"
data=[] count=None
I had it working, but it's stopped and I can't see any issues. I've tried with RLS enabled and disabled.
Any help would be very welcome.
I'm trying to update a database with data from Google Analytics periodically. I'm using the Python client and upsert. Even with a basic single line, it does not seem to be updating the table. Table definition is:
create table
public.users_by_day (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
"pagePath" text not null,
date date not null,
"totalUsers" bigint not null,
constraint users_by_day_pkey primary key ("pagePath", date)
) tablespace pg_default;
My code is:
from supabase import create_client, Client
url: str = 'https://{id}.supabase.co'
key: str = '{key}'
supabase: Client = create_client(url, key)
response = supabase.table("users_by_day").upsert('[{"pagePath": "/tags/thing", "date": "2023-12-21", "totalUsers": 434}]').execute()
print(response)
Printed to the terminal is:
2024-01-05 15:07:39,210:INFO - HTTP Request: POST https://**************************.supabase.co/rest/v1/users_by_day "HTTP/1.1 200 OK"
data=[] count=None
I had it working, but it's stopped and I can't see any issues. I've tried with RLS enabled and disabled.
Any help would be very welcome.