Insert Data into a Dataset

Insert data from an Action into a dataset

When working with Actions, you might need to save the results into a dataset. This can be easily done using the Insert Data in a Dataset step.

How to Use the Insert Data in a Dataset Step

Add the Component

To insert data into a dataset, you need to add an "Insert Data in a Dataset" step to your Action. Check how to get started with creating an Action for more details.

Dataset ID

You need to specify the name of the destination dataset. There are two possibilities:

  1. If you enter the name of an existing dataset, new entries will be added to it.

  2. If a new name is entered, a new dataset will be created to which the new entries will be saved.

Dataset Name Requirements: Must contain only lowercase letters, numbers, hyphens, and underscores.

By using the variable mode (as marked in the image above), you can use {{}} to provide the dataset name. For instance, if the dataset name is under an input component called ds_name, using {{ds_name}} in the Dataset ID field will pass the typed value to be used as the name.

Documents

"Documents" is a list (array) of JSON objects. You can:

  • Manually enter each document (i.e., JSON object) individually using the + Add new button.

  • Switch to the variable mode (as shown in the image above) and pass on the name of the variable containing the list of JSON objects.

Example

Let's say you want to save the analysis results from a sentiment analysis Action. First, make sure you have the Insert Data in a Dataset step added to your workflow. Set the Dataset ID to the name of your dataset (e.g., sentiment_results).

{
    "Dataset ID": "{{ds_name}}",
    "Documents": [
        {
            "text": "{{text_input}}",
            "sentiment": "{{sentiment_analysis.sentiment}}"
        }
    ]
}

Follow the links below for more information about:

To see the result, go to the Data page. You might need to refresh the page for the updates to reflect on the page. The new dataset or the new entries added to an existing dataset are accessible from the corresponding data table.

Common Errors

Dataset Name Not Matching the Convention

{"message":"Dataset Name must contain only lowercase letters, numbers, hyphens and underscores."} trace-id: 422...429d

Enter a valid name for your dataset and try again.

Wrong Document Format

What is passed as Documents must be a list/array of valid JSONs. If you see an error similar to the one below, you will need to reformat the input documents.

Bulk update: Studio transformation bulk_update input validation error: must be array {"type":"array"} /documents

Last updated