Skip to content

If you have installed the Supabase data source plugin, you will have access to the Supabase Database | Insert action in workflows:

Supabase insert action in a WeWeb workflow

In the example above, we are inserting one row in the cars table.

WARNING

By default Supabase tables have RLS (Row-Level Security) enabled. Before you insert a record in a Supabase table, make sure that table has the correct INSERT policies.

If the table requires a user to be authenticated to insert a record, make sure you are logged in as a user of your app when you test your workflow in WeWeb.

If you try to create a record without the proper authorization, Supabase will return an error.

Learn more about implementing Supabase RLS policies.

Single insert

With the Supabase insert action, you can create a Single record or Multiple records at once.

When creating a single new record in Supabase, all the table fields will be listed by default:

Fields for a single insert

TIP

Fields with a placeholder that starts with Default: will be filled out automatically by Supabase if left empty.

You can choose to select only the fields that you need upon creation of the record:

Select fields for a single insert

Multiple (bulk) insert

To insert multiple records at once, you have two options.

  1. Bind the Rows with a list of items

Send rows object to Supabase

In the example above, we are creating two records with the same values for both the make and model fields.

  1. Click on Add item and bind each Row to an object

Add two items to Supabase

TIP

When binding Rows, the Current value should be a list of items (i.e. an array of objects).

When binding a single item, i.e. a Row, the Current value should be a single object with key value pairs.

Expected format for Supabase multiple insert

Return inserted rows

By default, when you successfully insert a new record, Supabase will simply return a success message.

Depending on your use case, you may want Supabase to include the row(s) just created in its response.

To achieve this, you will need to enable the Return inserted rows option when configuring the insert action in WeWeb:

Returned fields

WARNING

If you enable this option, make sure you are testing the workflow with a user that has the rights to SELECT data from this table.

Otherwise, you will get an error because you are trying to read data without being authorized to do so.

Learn more about implementing Supabase RLS policies.

Using explain

EXPLAIN is a PostgreSQL command that can help you understand and optimize how your queries are performing.

This is an advanced backend feature that we recommend learning through the user documentation of Supabase and its underlying technology PostgreSQL.