We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the current version upsert() does not support on_conflict. I guess #139 is required for this request to be implemented.
upsert()
on_conflict
So here is a workaround for now, if someone comes across this issue:
def upsert(table_name, data, on_conflict, select): url = f'https://PROJECT_ID.supabase.co/rest/v1/{table_name}?on_conflict={on_conflict}&select={select}' headers = {"Content-Type": "application/json", "apiKey": "SECRET", "authorization": f'Bearer SECRET', "Prefer": "resolution=merge-duplicates,return=representation"} response = requests.post(url, headers=headers, json=data) return response.status_code # example response = upsert('automations', [{"name":"Germany"},{"name":"Italy"}], 'name', 'id')
The final solution could look like this:
data = supabase.table("countries").upsert([{"name":"Germany"}], on_conflict=["name"]).execute()
The text was updated successfully, but these errors were encountered:
Thanks for the workaround!
Going to move this to the postgrest-py repo so we can track. Hopefully we can push on_conflcit option over the finish line next weekend
postgrest-py
on_conflcit
Sorry, something went wrong.
Fixed by #142 hopefully - going to close but feel free to let me know if it doesn't work for you
No branches or pull requests
In the current version
upsert()
does not supporton_conflict
.I guess #139 is required for this request to be implemented.
So here is a workaround for now, if someone comes across this issue:
The final solution could look like this:
The text was updated successfully, but these errors were encountered: