Data sources

Why to use and how to create data sources

A data source is a collection of static data belonging to unit. All recipes inside the unit can access the data source by using the datasource function inside the transformation. This guide will explain how to create a data source.

How to create a new data source

  1. In the Navigation pane, navigate to Data Sources. It is recommended to name your data source according to the purpose of the data it holds.
  2. Select New Data Source.
  3. Enter a name for your new data source.
  4. Select Create.

How to configure a data source

When a Data Source has been created, there are two ways to configure it:

  1. Editing inside the table view.
  2. Providing a JSON array of objects.

To switch between the two views, select Table or JSON in the top-left. When you're done editing, Save your updates using the button next to the Table/JSON toggle. The way that these views relate to each other is that the data is assumed to be an array of objects with the same property names. Each property name can be represented by a column, and each array element by a new row. Compare the two representations of the same data source below.

Configure a data source as a data table

The Table toggle should be highlighted to edit data sources as a table. Add columns by selecting Add Column to the right of the table headers. Note that the table header will display Table contains no data when the table is just created. Add a row by selecting Add Row to the left of the table headers.

The values are added by typing into cells after adding rows and columns. Note that each piece of data must be of valid JSON data format. Meaning, for example, that the text data should be enclosed in double quotes (inserted into cells by default), numbers must not have quotes, an true and false are accepted as boolean values. If any data has been defined incorrectly for a row cell, an Invalid JSON error will be raised in the webpage.

Rows can be deleted by hovering over the index and selecting Delete, and columns need to be selected, at which point a Close button appears.

The table representation of a simple data source.

The table representation of a simple data source.

Configuring a data source as a JSON

The JSON toggle should be highlighted to edit data sources as JSON. The required structure of the JSON object is an array of objects, where each object represents one row in the table, and each property a column. The objects should, therefore, have the same properties.

The JSON representation of a simple data source.

The JSON representation of a simple data source.

See also