NoteYou can create up to 10 tables with 20 columns and 10,000 rows in the Free Plan. Get in touch if you want to increase the limits. However, the 20 columns per table is a hard limit that can’t be increased.
Table row capacity filling up quicker than you expected? Check your table’s row factor.
What are row factors?
What are row factors?
Every table has a row factor that determines the storage limit for each of its rows. When you create a new table, the default row factor is 1—this allows you store up to 4KB of data per row.If you need to store more than 4KB of data in each row, you can create a table with a higher row factor. However, increasing the table’s row factor makes each row count more towards your table’s row limit.Example: If you create a table with a row factor of 3, each row will have a storage limit of 12KB (because 4KB x 3 = 12KB). This will make each row will count as three rows towards your table’s row limit.You can check any table’s row factor in the bottom-right corner of that table.
Creating a Table
To add a new table, go to the explorer menu and selectAdd Table
. You can then give your table a name and add fields to it. Each field has a name and a type. The type determines the kind of data that can be stored in the field. For example, a field with the type String
can store any text value, while a field with the type Number
can only store numeric values.
Making Fields Searchable
You can make a field searchable by checking theSearchable
checkbox. This will allow you to search for records based on the values in the field. For example, if you have a field called Name
and you make it searchable, you can search for records based on the name of the person. This is available for fields of type String
, Object
, Array
and custom schemas.
Types of Fields (Columns)
There are several types of fields you can add to a table. Each field type has a specific purpose and can only store certain types of data. These are the field types you can choose from:String
, Number
, Boolean
, Date
, Object
, Array
and custom schemas.
WarningThe number of columns has a hard limit of 20 columns per table.
Filtering Records
Table filters are a powerful feature that allows you to refine and display only the records that meet certain criteria. Filters can be based on specific conditions, such as date ranges, text matches, and numerical comparisons.Logical Operators
-
AND: Use the AND operator when you want all conditions to be true for a record to be displayed. For example, filtering by
createdAt
ANDstatus
will only show records that match both conditions. -
OR: Use the OR operator to display records that match any one of multiple conditions. For example, filtering by
createdAt
ORupdatedAt
will show records that match either one of the conditions.
Types of Rules
Rules define the individual conditions applied to each column of data.is equal to
: Shows records where the field is equal to the specified value.is not equal to
: Shows records where the field isn’t equal to the specified value.less than
: Shows records where the field is less than the specified value.less than or equal to
: Shows records where the field is less than or equal to the specified value.greater than
: Shows records where the field is greater than the specified value.greater than or equal to
: Shows records where the field is greater than or equal to the specified value.in
: Shows records where the field matches any of the specified values.not in
: Shows records where the field doesn’t match any of the specified values.is null
: Shows records where the field is empty.is not null
: Shows records where the field isn’t empty.
Rule Groups
- Group: A group is a collection of rules combined by a logical operator (AND/OR). You can nest groups to create complex filters.
Creating a Filter
- Click on the
Filter
button to expand the filter menu. - Select a logical operator (AND/OR) from the dropdown.
- Choose a field to filter by (e.g.,
createdAt
). - Select a rule (e.g.,
is equal to
). - Enter the required value or select from a calendar if it’s a date field.
- To add another rule within the same logical condition, click the
+ Rule
button. - To create a nested group of conditions, click the
+ Group
button. - Apply the filter by clicking the
Apply filter
button.
Manually Editing Filters
Click on Edit Manually to view and edit the filter in JSON format. You can then copy this JSON filter and use it in your table operations via code.Operations on Tables - via the Interface
Add records to a table
Once you’ve created a table, you can add records to it. To do this, click on the table in the explorer menu. You’ll then see a list of all the records in the table. Click on theAdd Record
button to add a new record. You can then enter the values for each field in the record.
Update records in a table
Double click on a table cell or press click it and pressEnter
to see an input that allows you to change the cell value. Once you are done, press Enter
again or click away to save the new value.
Delete records from a table
Right Click
on the Record and select Delete Record
to delete a record from a table.
Operations on Tables - via Cards
Check out the Table Cards documentation to learn more about operations with cards.Operations on Tables - via Botpress Client
You can also interact with tables using the Botpress Client. Here are some of the functions you can use to interact with tables:List tables
To list all the tables in the bot, use thelistTables
function. This function will return an array of all the tables in the bot.
Create Table Rows
Execute the following query to create one or multiple rows. The response will include the inserted rows, along with any encountered errors or warnings during the operation (e.g., unrecognized fields)Find & Filter Table Rows
To find and filter rows in a table, use thefindTableRows
function. You can specify the limit (number of records to return) and the offset (number of rows to start from).
Projection & Aggregation
Employ the group property for projections and aggregations. The following example demonstrates returning a single row with requested data.Column | Type | Key | Count | Sum | Avg | Max | Min | Unique |
---|---|---|---|---|---|---|---|---|
id | number | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
createdAt | date | ✔️ | ✔️ | ✔️ | ✔️ | |||
updatedAt | date | ✔️ | ✔️ | ✔️ | ✔️ | |||
name | string | ✔️ | ✔️ | ✔️ | ✔️ |
Count: Returns the total number of non-null values
sum: Returns the sum of all values
Avg: Returns the average of all values
Max: Returns the maximum value
Min: Returns the minimum value
Unique: Returns a list of unique values Providing one or multiple keys yields more specific results.
Update Table Rows
This operation updates rows based solely on their numeric IDs.Delete Table Rows
Rows can be deleted from a table in three distinct manners, each mutually exclusive. By specifying row IDsBy applying a filter
By removing all rows
Upsert Table Rows
The upsert operation is a combination of insert or update, allowing you to insert new rows or update existing ones. The operation is based on the row’skeyColumn
.
keyColumn
: The column used to identify the row. This column must be unique. Failure occurs if more than one row is found for the same key.
Create Table
To create a table, simply provide a name and a schema. The naming convention follows the same rules as those applied within the studio. Initially, the schema can be empty and populated or modified later. The schema accepts either an example object, from which it will infer the structure, or a directly provided JSON schema.Update Table
You can update a table’s name, schema, or both. Providing only one of these attributes is also permissible. Should you alter the type of an existing column, be advised that all its entries will default to NULL.Adding a new field
Removing an existing field:
Renaming the table
A table name must end with “Table”.Rename Table Column
To rename a table column, specify both the current and new names. The column’s data type and attributes will remain unchanged.Get Table
To retrieve a table’s schema, use thegetTable
function. This will return the table definition, along with the total number of rows, number of stale rows and number of indexing rows.
Delete Table
To delete a table, use thedeleteTable
function. This will permanently remove the table and all its records.
Operations on Tables - via Code

Create record
To create a new record in a table, use thecreateRecord
function. You can specify the values for each field in the record. This function can be particularly useful when you need to store new information, such as a new user’s details or a newly completed transaction.
Create records
To create multiple records in a table, use thecreateRecords
function. You can specify the values for each field in the record. Useful for creating multiple records at once.
Delete record
To delete a record in a table, use thedeleteRecord
function. You need to specify the record ID of the record you want to delete.
Delete records
To delete multiple records in a table, use thedeleteRecords
function. You need to specify the record IDs of the records you want to delete in an array.
Find records
To find records in a table, use thefindRecords
function. You can add filters, just query everything or search using semantic search (like a Google Search!).
Basic usage and pagination
To retrieve data from a table in Botpress, you can use thefindRecords
function. This function allows you to specify the limit (number of records to return) and the offset (number of rows to start from).
For instance, if you want the first 10 records, you can set the limit to 10 and the offset to 0. To fetch the next 10 records, you can set the limit to 10 and the offset to 10.
To determine if there are more records available, you can check the length of the array returned. If the length is greater than 0, it indicates the presence of additional records.
Here’s an example:
Searching fields with natural language
To perform a traditional search, use the search parameter when calling the DataTable1.findRecords() function in Botpress. Here is an example:Filtering results
You can filter results using filters. Similar to MongoDB, this code provides methods to filter results. The filtering mechanism can be divided into two main categories: Primitive and Logical. Don’t want to deal with code? Skip to the next section for AI generated filters.Primitive Filter
Primitive filters are easy and simple to use, allowing you to match the exact values you are looking for. Here are some of the primitives you can use:-
$eq
: Matches values that are equal to a specified value. -
$gt
: Matches values that are greater than a specified value. -
$gte
: Matches values that are greater than or equal to a specified value. -
$lt
: Matches values that are less than a specified value. -
$lte
: Matches values that are less than or equal to a specified value. -
$ne
: Matches all values that aren’t equal to a specified value. -
$in
: Matches any of the values specified in an array. -
$nin
: Matches none of the values specified in an array. -
$exists
: Matches documents that have the specified field. -
$mod
: Performs modulo operation on the value of field and matches documents where field % divisor equals the specified remainder. -
$size
: Matches any document where an array field contains a specified number of elements. -
$regex
: Provides regular expression capabilities for pattern matching strings in queries. It uses a placeholder to prevent SQL injections. -
$options
: Modifies the$regex
operator to enable options. Currently, there are two options, ‘i’ for case-insensitive and ‘c’ for case-sensitive.
Logical Filter
Logical operators allow you to connect more filtering clauses.-
$and
: Joins query clauses with a logical AND. Returns all documents that match the conditions of both clauses. -
$or
: Joins query clauses with a logical OR. Returns all documents that match the conditions of either clause. -
$not
: Inverts the effect of a query expression and returns documents that don’t match the query expression.
Using AI to generate filters
Thankfully, Botpress comes with artificial intelligence (AI) capabilities when it comes to filtering records. This means you can provide a human-like query, and the AI will intelligently decipher it and create the right filters for your query. This can significantly simplify the construction of complex queries and reduce the likelihood of human errors in the process.Re-using filters (selectors)
Selectors are filters that you can re-use. They don’t have to be written again and again. For example, you might use the query selector “People with age greater than 18” to find all users who are above 18.- Create a query selector in the table and give it a name. (for example: adults)
- Add query as
People with age greater than 18
- use below code to find records and save it in a variable called
adults
Difference between search and AI filters
A standardSearch
in Botpress is employed to identify specific strings like a user’s name. It gives precision-based results by matching specific sets of characters.
On the other hand, an AI Filter
broadens the scope and is used primarily for filtering results rather than explicitly searching them. It helps you track down users based on certain criteria, such as age above 25.
Although the AI Filter isn’t primarily designed for exact string hunting, it’s flexible enough to allow it. For instance, you could use it to filter results for Canada
as a country.
Get record
You can use thegetRecord
function to retrieve a specific record from a table based on a unique identifier. For example, you might use the getRecord
function to retrieve a user’s profile information based on their unique user ID.
Update record
You can use theupdateRecord
function to modify a specific record in a table. This will be useful when you need to update a specific field in the record. For example, you might use this function to update a user’s profile information or to update the status of a transaction.
Upsert record
TheupsertRecords
function allows you to update or create records in a table in a single operation. It’s useful for any situation where you need to update or insert data into a table without having to worry about whether the rows already exist.
Example:
Computed Columns
Columns can be marked as “Computed” which allows the to observe changes in tables and generate computed values. This includes leveraging AI, as well as running code. This can be useful for a wide variety of use cases such as CRM enrichment, sentiment analysis, classification. To use computed columns, simply create a column and toggle the Computed field as shown below.
Selecting the basis of computation
To compute columns, you must select what information you will base your computed columns on. To do so, click the Dependencies field and select all column names that you will use.
AI-based computed columns
You can perform AI text generation tasks by filling the prompt and including rows like this {{propertyName}}.Code-based computed columns
To run arbitrary code, select the Execute code tab. Then, click Edit Code.

Updating computed values
To ensure computed values are always kept up to date, we recommend Auto-compute be toggled on.

Importing and Exporting
Import a Table
You can import a table from a CSV file. Click on theImport Table
button above the table and select the CSV file you want to import. Botpress will automatically detect the column names and types from the CSV file and create the table structure for you.
Export a Table
Click on theExport Table
button to export the table. This will download the table as a CSV file to your computer.
ReminderDon’t edit the CSV file directly to avoid data loss and import errors. Instead, make the changes in Botpress Studio and then export the updated table again.
NoteWhen you export a bot, the tables are exported as well so there is no need to export them separately unless you want to use them in another bot.