Skip to main content
Version: 2.35.0

ToolJet Database

Use the ToolJet-hosted database to build apps faster, and manage your data with ease. ToolJet database require no setup and give you a powerful user interface for managing your data.

ToolJet database

Enabling the ToolJet Database for your instance

Requires:

  • PostgREST server
  • Additional configuration for ToolJet server

This feature is only enabled if ENABLE_TOOLJET_DB is set to true.

PostgREST Server

PostgREST is a standalone web server that turns your PostgreSQL database directly into queryable RESTful APIs which is utilized for Tooljet Database. This server only talks with ToolJet server and therefore does not have to be publicly exposed.

tip

If you have openssl installed, you can run the following command openssl rand -hex 32 to generate the value for PGRST_JWT_SECRET.

If this parameter is not specified then PostgREST refuses authentication requests.

Variable
Description
PGRST_JWT_SECRETJWT token client provided for authentication
PGRST_DB_URIdatabase connection string for tooljet database
PGRST_LOG_LEVELinfo
info

Please make sure that DB_URI is given in the format postgres://[USERNAME]:[PASSWORD]@[HOST]:[PORT]/[DATABASE]

Additional ToolJet server configuration

Variable
Description
ENABLE_TOOLJET_DBtrue or false
TOOLJET_DBDefault value is tooljet_db
TOOLJET_DB_HOSTdatabase host
TOOLJET_DB_USERdatabase username
TOOLJET_DB_PASSdatabase password
TOOLJET_DB_PORTdatabase port
PGRST_JWT_SECRETJWT token client provided for authentication
PGRST_HOSTpostgrest database host

If you intent to make changes in the above configuration. Please refer PostgREST configuration docs.

tip

When this feature is enabled, the database name provided for TOOLJET_DB will be utilized to create a new database during server boot process in all of our production deploy setups. Incase you want to trigger it manually, use the command npm run db:create on ToolJet server.

Features

ToolJet database allows you to:

Accessing ToolJet Database

Once you log-in to your ToolJet account, from the left sidebar of the dashboard you can navigate to ToolJet Database.

The ToolJet Database is available on: ToolJet Cloud, Self-Host, and Enterprise Edition. You can view and manage your database and the data it contains using the Database editor UI.

ToolJet database

Database Editor

You can manage the ToolJet Database directly from the Database Editor. ToolJet Database organizes the data into tables that can have different structures. All the tables will be listed lexicographically on the left, click on any of the table to view the table data.

ToolJet database

The sidebar on the left can also be collapsed to give more space to the database editor.

ToolJet database

Create New Table

For creating a new table in ToolJet Database, click on the Create New Table button on the top left corner of the Database editor.

ToolJet database

When the Create New Table button is clicked, a drawer opens up from the right from where you can enter the details of your new table.

ToolJet database

For creating a new table, you'll need to:

  • Enter a Table name
  • Add Columns (id column with serial data type is automatically created as the primary key of the table)

Supported Data Types

Data Type
Description
Example
serialserial is used to generate a sequence of integers which are often used as the Primary key of a table. Whenever a new table is created in the ToolJet database, a column id with the serial data type is automatically created as the primary key of the table.Numbers starting from 1, 2, 3, 4, 5, etc.
varcharvarchar data type is used to store characters of indefinite lengthAny string value
intint is a numeric data type used to store whole numbers, that is, numbers without fractional components.Numbers ranging from -2147483648 to 2147483647
bigintbigint is a numeric data type that is used to store whole numbers, that is, numbers without fractional components.Numbers ranging from -9223372036854775808 to 9223372036854775807
floatfloat is also a numeric data type that is used to store inexact, variable-precision values.Any floating-point number, ex: 3.14
booleanboolean data type can hold true, false, and null values.true or false
ToolJet database

Search Table

Open the Search bar by clicking on the Search button and search for a table in the ToolJet database by entering the table name.

ToolJet database

Rename Table

To rename a table, click on the kebab menu icon on the right of the table name and then select the Rename table option. A drawer will open from the right from where you can edit the table name.

ToolJet database

Add New Column

To add a new column on a table, either click on the kebab menu icon on the right of the table name and then select the Add new column option or click on the + button present at the end of the column header.

ToolJet database

A drawer from the right will open up where you can enter the details for the new column:

  • Column Name: Enter a unique name for the new column, serving as its key identifier.
  • Data Type: Choose the appropriate data type for the column from the available options.
  • Default Value: Specify any default value that should be assigned to the column. Optionally, users can leave this field blank. When a table contains rows and NOT NULL is applied to one of its existing or new columns, specifying a default value becomes compulsory.
  • NULL/NOT NULL: Use the switch to determine whether the column should allow NULL values or not. By default, the toggle is off, allowing the column to have blank or empty entries. If you turn it on, the column is set to NOT NULL, meaning it can't have blank or empty entries anymore. But, for text columns, even with NOT NULL on, they can still have empty text (like an empty line) but not completely blank entries
ToolJet database

Export Schema

The export schema option allows you to download the selected table schema in a JSON file. This does not export the table data.

While exporting the app, you can choose to export the app with or without table schema connected to the app.

To export the table schema, click on the three vertical dots icon on the right of the table name and then click on the Export option. A JSON file will be downloaded with the table schema.

ToolJet database

Delete Table

To delete a table, click on the three vertical dots icon on the right of the table name and then click on the Delete option. A confirmation modal will appear, click on the Delete button to delete the table.

ToolJet database

Edit Column

To edit a column, click on the kebab menu on the column name and select the option to Edit column. When you edit the column, the data type cannot be changed.

ToolJet database

Delete Column

To delete a column, click on the kebab menu on the column name and select the option to Delete.

ToolJet database

Add New Data

The Add new data button on the top of the table editor allows you to add data to the table. You can either Add new row or Bulk upload data to add the data to the table.

ToolJet database

Add New Row

To add a new row on a table, either click on the Add new data button on top and then select the Add new row option or click on the + button present at the bottom left.

ToolJet database

A drawer from the right will open up where the values for the new row can be provided.

ToolJet database

Edit Row

To edit a row, hover on the row that you want to edit and the expand icon will appear next to the checkbox of that row. Click on the Expand icon to open the drawer and edit the row.

ToolJet database

Edit a Cell

  1. Double-Click: Double-click on the cell you want to edit.
  2. Enter Value: Input the new value.
  3. Save Changes: Press "Enter" to save the changes. For boolean-type columns, choose from "True," "False," or "Null" options.
ToolJet database

Bulk Upload Data

You can bulk upload data to the ToolJet database by clicking on the Bulk upload data button on the top of the database editor. On clicking the button, a drawer will open from the right from where you can upload a CSV file. This file is used to upsert records onto the table. If data for id column is missing it will insert new record with the row data else if id is present it will update the corresponding record with the corresponding row data.

From the drawer, users can download the template CSV file in which they can enter the data to be uploaded to the ToolJet database's table or format their CSV file in the same way as the template file.

Once the CSV file is ready, click on the file picker to select the file or drag and drop the file in the file picker. Now, click on the Upload data button to upload the data to the ToolJet database.

Requirements:

  • The data types of columns in the CSV file should match those in the ToolJet database table.
  • The id column with a serial data type should not contain duplicate values.

Limitations:

  • There is a limit of 1000 rows per CSV file that can be uploaded to the ToolJet database.
  • The CSV file should not exceed 2MB in size.
ToolJet database

Delete Records

To delete one or many records/rows, select on the checkbox at the right of the record or records that you want to delete. As soon as you select a single record, the button to delete record will appear on the top, click on the Delete record button to delete the selected records.

ToolJet database

Filter

You can add as many filter as you want into the table by clicking on the Filter button present on the top of the database editor.

Adding a filter on the table data

  • Select a column from the Columns dropdown
  • Choose an operation
  • Enter a value for the selected operation

Available operations are:

  • equals: This operation is used to check if the value of the column is equal to the value entered in the input field.
  • greater than: This operation is used to check if the value of the column is greater than the value entered in the input field.
  • greater than or equal: This operation is used to check if the value of the column is greater than or equal to the value entered in the input field.
  • less than: This operation is used to check if the value of the column is less than the value entered in the input field.
  • less than or equal: This operation is used to check if the value of the column is less than or equal to the value entered in the input field.
  • not equal: This operation is used to check if the value of the column is not equal to the value entered in the input field.
  • like: This operation is used to check if the value of the column is like the value entered in the input field. This operation is case-sensitive. ex: ToolJet will not match tooljet
  • ilike: This operation is used to check if the value of the column is like the value entered in the input field. This operation is case-insensitive. ex: ToolJet will match tooljet
  • match: This operation is used to check if the value of the column is like the value entered in the input field. This operation is case-sensitive. ex: ToolJet will not match tooljet. This operation uses regular expressions. ex: ^ToolJet$ will match ToolJet but not ToolJet Inc.
  • imatch: This operation is used to check if the value of the column is like the value entered in the input field. This operation is case-insensitive. This operation uses regular expressions. ex: ^ToolJet$ will match ToolJet but not ToolJet Inc.
  • in: This operation is used to check if the value of the column is in the list of values entered in the input field. ex: 1,2,3
  • contains: This operation is used to check if the value of the column contains the value entered in the input field. This operation is case-sensitive. ex: ToolJet will not match tooljet
  • contained: This operation is used to check if the value of the column is contained in the value entered in the input field. This operation is case-sensitive. ex: ToolJet will not match tooljet
  • not: This operation is used to negate the result of the operation selected in the dropdown. ex: not equals will return all the records where the value of the column is not equal to the value entered in the input field.
ToolJet database

Sort

To sort the table data, click on the Sort button on top, select a column from the dropdown, and then choose an order ascending or descending.

ToolJet database

Querying Data from the ToolJet Database

Querying ToolJet database is as easy as querying any other datasource on ToolJet.

  • Go to the query panel, and click on the +Add button to add a new query, and select ToolJet Database

    ToolJet Database editor
  • Select the table that you want to query from the dropdown, choose an operation from the dropdown, and then enter the required parameters for the selected operation. Click on the Run button to execute the query.

    ToolJet Database editor
    info
    • Preview button on the query panel returns the query response without executing the query. Once clicked, the response will be displayed on the Preview section of the query panel which can be viewed as JSON or Raw.
    • When a new query is created, by default the query name is set to tooljetdbN (where N is a number) - you can rename the query by click on the query name or from the left sidebar of query panel.

Available Operations

List Rows

This operation returns all the records from the table

Optional Parameters

  • Filter: Add a condition by choosing a column, an operation, and the value for filtering the records.
  • Sort: Sort the query response by choosing a column and the order (ascending or descending).
  • Limit: Limit the number of records to be returned by entering a number.

Create row

This operation creates a new record in the table. You can create a single record or multiple records at once.

Required Parameters

  • Columns: Choose the columns for which you want to add values for the new record and enter the values for the selected columns. You can also add a new column by clicking on the +Add column button.

Update Row

This operation updates a record in the table. You can update a single record or multiple records at once.

Required Parameter

  • Filter: Add a condition by choosing a column, an operation, and the value for updating a particular record.
  • Columns: Choose the columns for which you want to update the values for the selected record and enter the values for the selected columns.

Delete Row

This operation deletes a record in the table. You can delete a single record or multiple records at once.

Required Parameters

  • Filter: Add a condition by choosing a column, an operation, and the value for deleting a particular record.
  • Limit: Limit the number of records to be deleted by entering a number.

Join Tables

You can join two or more tables in the ToolJet database by using the Join operation.

Required Parameters

  • From: In the From section, there are the following parameters:

    • Selected Table: Select the table from which you want to join the other table.
    • Type of Join: Select the type of join you want to perform. The available options are: Inner Join, Left Join, Right Join, and Full Outer Join.
    • Joining Table: Select the table that you want to join with the selected table.
    • On: Select the column from the selected table and the joining table on which you want to join the tables. Currently, only = operation is supported for joining tables.
    • AND or OR condition: You can add multiple conditions by clicking on the +Add more button below each join. The conditions can be joined by AND or OR operation.
    ToolJet Database editor
  • Filter: Add a condition by choosing a column, an operation, and the value for filtering the records. The operations supported are same as the filter operations for the List rows operation.

  • Sort: Sort the query response by choosing a column and the order (ascending or descending).

  • Limit: Limit the number of records to be returned by entering a number.

  • Offset: Offset the number of records to be returned by entering a number. This parameter is used for pagination.

  • Select: Select the columns that you want to return in the query response. By default, all the columns are selected.

    ToolJet Database editor
info

If you have any other questions or feedback about ToolJet Database, please reach us out at [email protected] or join our Slack Community