RDS Supabase is built on Alibaba Cloud RDS for PostgreSQL and offers standard PostgreSQL capabilities. It automatically generates Data APIs, including RESTful APIs, that allow you to immediately perform create, read, update, and delete (CRUD) operations on your data.
Basic operations
Retrieve data
Use the select() method to query data from a table or view.
const { data, error } = await supabase
.from('characters')
.select()Insert data
Use the insert() method to add new rows to a table.
const { error } = await supabase
.from('countries')
.insert({ id: 1, name: 'Mordor' })Update data
Use the update() method to modify existing rows in a table.
const { error } = await supabase
.from('instruments')
.update({ name: 'piano' })
.eq('id', 1)Upsert data
The upsert() method intelligently updates or inserts data. Use the onConflict parameter to specify one or more columns to check for conflicts. If a row with a matching value already exists, the method updates that row. If no matching row exists, it inserts a new row.
const { data, error } = await supabase
.from('instruments')
.upsert({ id: 1, name: 'piano' })
.select()
const { data, error } = await supabase
.from('users')
.upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' }, { onConflict: 'handle' })
.select()Delete data
Use the delete() method to remove specified rows from a table.
const response = await supabase
.from('countries')
.delete()
.eq('id', 1)References
To learn more about Supabase database features, see Database.
For more information about the Supabase JavaScript SDK, see JavaScript.
To learn about the Supabase REST API for managing databases, see Postgres REST API.