Interact with your Supabase database directly from your Bubble.io app.
In this section, we’ll explore the process of interacting with the
PostgreSQL database provided by Supabase from within your Bubble.io app.
Note: Please ensure that a Supabase Auth component is visible on every page of your app. This is crucial because this component initiates the connection with your Supabase
instance.
Setup
Add the element
Supabase Database
to your page.Note: You can use a separate database component for each Supabase table
that you want to manage within your Bubble.io application.
Plugin Element Properties
Title | Description | Type |
Data type | You must first initialize the API Connector in order to select the correct type. Please refer to the documentation for detailed instructions. | App type |
DB schema | The Postgres schema which this table belong to. | Text |
Table | Supabase table name (e.g. todos). | Text |
Expected response (JSON object) | By default, the plugin attempts to automatically retrieve the expected result based on the type defined in the API connector. To prevent any retrieval failures and ensure that the plugin can properly publish results from Supabase, we recommend you paste your schema into this field. This schema should match the one you have already entered in the API connector. | JSON |
Listen to changes in real-time? | Receive real-time updates on Insert, Update or Delete. By default, realtime is disabled on the Supabase database. | Yes/No |
Joined tables | By default, when you enable real-time updates (with "Listen to changes"), the plugin subscribes to changes on the selected table. If you are using a query join, for example, fetching author names (from the author table) associated with books (from the books table), you can specify here the joined tables to receive real-time updates on them (authors in this example). | Yes/No |
Debug realtime? | If enabled, debug messages for real-time events will be logged to the browser console, providing detailed insights into its behavior. This will result in verbose console output and is recommended to be disabled in a production environment. | Yes/No |
Fetch on page load? | Automatically fetch data when the page loads. You can still fetch data anytime using the Fetch action in your workflow. | Yes/No |
Columns | Allows you to specifiy specific columns. If you leave columns empty or set it to *, it will fetch all columns in the table. | Text |
Filters | Query filters to narrow down the results. Please check the documentation for more details. | Text |
Nulls first? | If true, null values are treated as the lowest possible values when sorting in ascending order and as the highest possible values when sorting in descending order. This applies to all columns where ordering is enabled. The default is true. | Yes/No |
Order By | The column to order by. Leave empty to not order results. | Text |
Ascending order? | When set to true, the query will use an ascending order for this column. | Yes/No |
Limit Count | The maximum number of rows to return. Setting this to 0 does not apply any limit. | Number |
Limit By Range | When set to true, the query will limit results to a specific range defined by 'Limit From' and 'Limit To'. | Yes/No |
Limit From | The starting index from which to limit the result. This index is 0-based, meaning an index of 0 refers to the first record. | Number |
Limit To | The last index to which to limit the result. This is inclusive, so the record at this index will be included in the result. | Number |
Count | Count algorithm to use to count rows in the table or view. Options: exact (Exact but slow count algorithm, performs a COUNT(*) under the hood), planned (Approximated but fast count algorithm, uses the Postgres statistics under the hood), estimated (Uses exact count for low numbers and planned count for high numbers). | Dropdown |
Head | When set to true , data will not be returned. Useful if you only need the count. | Yes/No |
Expected response (JSON) | By default, the plugin attempts to automatically retrieve the expected result based on the type defined in the API connector. To prevent any retrieval failures and ensure that the plugin can properly publish results from Supabase, we recommend you paste your schema into this field. This schema should match the one you have already entered in the API connector. | JSON |
Exposed states
Name | Description | Type |
Objects | Contains the objects retrieved from your Supabase table. | List |
Object | In case the results contain only one object, this field will contain that specific object retrieved from your Supabase table. | Object |
Bulk data | Local data to use for bulk insert or upsert actions. | List |
Patched object | Local object to use with the Patch JSON action. | Object |
Realtime channels | List of channels subscribed to for real-time updates. | List |
Is loading? | Indicates if the component is currently fetching data. | Boolean |
Is success? | Indicates if the last action was successful. | Boolean |
Status code | The status code will be '200' in case of success, and a different code in case of an error. | Text |
Status message | The status message will be 'success' in cases of success, and it will contain error details in cases of an error. | Text |
Count | Number of rows fetched when using the options count. | Number |
Count insert | Number of added rows when using the options count. | Number |
Count update | Number of updated rows when using the options count. | Number |
Count delete | Number of deleted rows when using the options count. | Number |
Count upsert | Number of upserted rows when using the options count. | Number |
Last insert | Last object added using the insert action. | Object |
Last update | Last object updated using the update action. | Object |
Last upserts | Last object upserted using the upsert action. | Object |
Last inserts | List of objects added using the insert action. | List |
Last updates | List of objects updated using the update action. | List |
Last upserts | List of objects upserted using the upsert action. | List |
Element Events
Name | Description |
Call success | Triggered when a successful response is received from Supabase. |
Call error | Triggered when an error is received from Supabase. |
Fetched | Triggered when data has been successfully fetched from Supabase. |
Fetch error | Triggered when receiving an error while fetching data. |
Inserted | Triggered when data has been successfully inserted to Supabase. |
Insert error | Triggered when receiving an error while inserting data. |
Updated | Triggered when data has been successfully updated on Supabase. |
Update error | Triggered when receiving an error while updating data. |
Upserted | Triggered when data has been successfully upserted to Supabase. |
Upsert error | Triggered when receiving an error while upserting data. |
Deleted | Triggered when data has been successfully deleted from Supabase. |
Delete error | Triggered when receiving an error while deleting data. |
CSV exported | Triggered when the current results have been exported as CSV. |
CSV export error | Triggered when receiving an error while exporting the current results as CSV. |
New realtime event | Triggered when a new realtime event (insert, update or delete) is received. |
New realtime insert | Triggered upon a new record insertion into the database. |
New realtime update | Triggered upon a record update in the database. |
New realtime delete | Triggered when a record is deleted from the database. |
Realtime subscribed | Triggered when all channels have been subscribed. |
Realtime unsubscribed | Triggered when all channels have been unsubscribed. |
Realtime error | Triggered when receiving a realtime error. |
Note: Explore our demo app to see how to effectively use the database component in your app.