Help Centre › Building Processes
This article describes the RPA Database functionality to bulk insert rows into a table.
For a full list of available functions, please read DATABASE functions.
Description
The Bulk insert rows function inserts multiple rows into a database table from a list of dictionaries. Each dictionary represents a row, with keys mapping to column names. Rows are inserted in configurable batches for performance.
Setting it up
To use the Bulk insert rows function, follow these instructions:
{{popups:rpas/add:action=db-bulk-insert}}
Once on a process map:
- Navigate to the process where you would like to add the Bulk insert rows function
- Click on the green button's drop-down (right side of the green button labelled "Process")
- On the menu that appears, click on the "+ Activity" item
- From here you can select the Bulk insert rows option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Name | Yes | Text | - | The alias of a previously opened connection (from db-connect) |
| Table | Yes | Text | - | The target table name |
| Rows | Yes | Array of dictionaries | - | The data to insert, where each dictionary represents a row with column names as keys |
| Batch size | No | Number | 1000 | The number of rows to insert per batch |
| Variable | No | Text | inserted_rows | Variable name to store the total number of inserted rows |
Output variables
| Variable | Type | Description |
|---|---|---|
| {inserted_rows} | Integer | The total number of rows successfully inserted |
Errors
| Error | Description |
|---|---|
| Connection not found | No open connection exists with the specified name |
| Table not found | The specified table does not exist in the database |
| Column mismatch | The dictionary keys do not match the table columns |
Tips
- Adjust batch_size to balance memory usage and performance – smaller batches use less memory, larger batches are faster
- The keys in the first dictionary define the column mapping for all rows
- Use db-list-columns to verify column names before inserting