docs/versioned_docs/version-2.10.0/tooljet_database.md
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.
<div style={{textAlign: 'center'}}> </div>Requires:
This feature is only enabled if ENABLE_TOOLJET_DB is set to true.
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
command openssl rand -hex 32 to generate the value for PGRST_JWT_SECRET.
If this parameter is not specified, PostgREST will refuse authentication requests. :::
| variable | description |
|---|---|
| PGRST_JWT_SECRET | JWT token client provided for authentication |
| PGRST_DB_URI | database connection string for tooljet database |
| PGRST_LOG_LEVEL | info |
:::info
Please make sure that DB_URI is given in the format postgres://[USERNAME]:[PASSWORD]@[HOST]:[PORT]/[DATABASE]
:::
| variable | description |
|---|---|
| ENABLE_TOOLJET_DB | true or false |
| TOOLJET_DB | Default value is tooljet_db |
| TOOLJET_DB_HOST | database host |
| TOOLJET_DB_USER | database username |
| TOOLJET_DB_PASS | database password |
| TOOLJET_DB_PORT | database port |
| PGRST_JWT_SECRET | JWT token client provided for authentication |
| PGRST_HOST | postgrest 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.
:::
ToolJet database allows you to:
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.
<div style={{textAlign: 'center'}}> </div>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.
<div style={{textAlign: 'center'}}> </div>For creating a new table in ToolJet Database, click on the Create New Table button on the top left corner of the Database editor.
<div style={{textAlign: 'center'}}> </div>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.
<div style={{textAlign: 'center'}}> </div>Click on Create button to create a new table.
<div style={{textAlign: 'center'}}> </div>You can enter a search term to search through all tables in the database.
<div style={{textAlign: 'center'}}> </div>You can add a new column to the existing table by clicking on the Add new column button from the top of the database editor.
A drawer from the right will open up from where you can create a new column by entering the values for the new column such as:
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.
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.
<div style={{textAlign: 'center'}}> </div>To add a new row to the existing table data, click on the Add new row button. A drawer will open from the right where you can enter the values for the new row.
<div style={{textAlign: 'center'}}> </div>To edit the rows from the ToolJet database dashboard, click on the Edit row button. A drawer will open from the right from where first you need to select the id of the row to be edited from the dropdown and then you can edit the cell values of the selected row.
<div style={{textAlign: 'center'}}> </div>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.
<div style={{textAlign: 'center'}}> </div>To delete a particular column, just click on the column name and the delete button will appear, click on it to delete the column.
<div style={{textAlign: 'center'}}> </div>When you click on the kebab menu (three vertical dots icon) on the right of the table name, you'll get two options: Edit and Delete.
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 Run ToolJetDb query
<div style={{textAlign: 'center'}}> </div>Enter the Name of the table that you want to query, select an Operation from the dropdown, Create the query, and then Run the query to get the response.
<div style={{textAlign: 'center'}}> </div>:::info
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.
:::This operation returns the list of all the records in the table
This operation creates a new record in the table
This operation updates an existing record in the table
This operation deletes a record from the table
:::info If you have any other questions or feedback about ToolJet Database, please reach us out at [email protected] or join our Slack Community :::