Skip to content
New issue

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

Add support for upsert #105

Closed
josiahsrc opened this issue Dec 24, 2021 · 0 comments · Fixed by supabase-community/postgrest-py#47
Closed

Add support for upsert #105

josiahsrc opened this issue Dec 24, 2021 · 0 comments · Fixed by supabase-community/postgrest-py#47

Comments

@josiahsrc
Copy link

Is your feature request related to a problem? Please describe.
A lot of the time I need to either insert data or update existing data (depending on if it's created or not).

Describe the solution you'd like
Add upsert functionality.

Describe alternatives you've considered
A query followed by an insert or update.

data = supabase.table('table').select(*).eq('id', 'something').execute()
if len(data.get('id', [])) > 0:
  // update the data
else:
  // insert the data

Additional context
Taken from the supabase docs, I couldn't find this functionality in this library. Does something to this effect exist yet?

const { data, error } = await supabase
  .from('messages')
  .upsert({ id: 3, message: 'foo', username: 'supabot' })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant