Skip to main content

Loaders

A Load job maps the responses of an Extract job into one table with typed columns. A Transform job then reads that table. In the Load job editor you choose the source requests, the columns and their types, the key, and what happens to rows with the same key.

For every key that the job instructions accept, see the Loader instructions reference.

The Load job editor after a Preview, with the columns at the top and the rows on Output.
The Load job editor after a Preview, with the columns at the top and the rows on Output.

Build a Load job​

  1. In the toolbar of the Extract job, select +, enter a name, and select Add job.
  2. In Table, enter the name of the destination table.
  3. Select Preview. The Response tab shows a response of the Extract job.
  4. On the Response tab, select each value that you need. Each value becomes a column.
  5. Check the Column name and the Type of each column.
  6. Select Key for the columns that together identify one row.
  7. Under Rows with the same key, choose what happens to repeated keys.
  8. Select Preview again. The Output tab shows the table.

A line above the columns shows the next step, such as Next: name the Table. When everything is in place, it shows Ready to preview.

What a Load job can read​

FormatOne row isA column reads
CSVA line under the headerOne exact header name
JSONOne object, each item of a list, or the rows that you selectA key or a JSON path
NDJSONThe same as JSON, for the document on each lineA key or a JSON path
ParquetA rowOne exact column name
XMLThe rows that you selectA JSON path

Hypermeter detects the format of each response. You do not set it. Text and binary responses are not supported.

Hypermeter reads an XML response as JSON, so you select rows and map columns with JSON paths. For the shape, see XML response bodies. An XML response always needs a row selection, and it can be at most 8 MiB. The editor does not check nested XML mappings: select Preview to see the loaded rows.

When a CSV header occurs more than once, the repeats get the names name_1, name_2, and so on. For example, map the second created_at column as created_at_1.

Choose the source requests​

A Load job reads only the requests that you select. A Load job that you add to an existing Extract job starts with the requests that fit. A Load job without sources shows Choose source requests.

  1. On the Response tab, select Sources next to the request picker.
  2. Select the requests. Each request shows its format and the number of items from the last Preview.
  3. With two or more requests, use the move buttons to set the order.
  4. Select Save sources.
Icon after a requestWhat it means
Amber warningThe Preview response of the request does not fit the columns or Rows, for example Not in this response: customer_id. You can still select the request.
InformationHypermeter could not check the request, for example because it has no Preview response.

Rules:

  • All selected requests use the same columns and load into one table. Select requests that return the same kind of data, such as one request for each region.
  • Save sources also turns on Load for the selected requests.
  • A request that you add to the Extract job later is not added to the Load job.
  • The order decides which row wins when two requests bring the same key. See Rows with the same key.
  • Without a source, you cannot preview the Load job or publish the workflow.
  • One load reads at most 4,096 source files across all requests. A file with many rows counts as one file. Above the limit, the load fails before it reads a row, and a retry does not help. Narrow the extraction, or divide it over several runs.

Set the destination table​

Enter the name in Table. Hypermeter creates the table when needed.

  • The name starts with a letter or an underscore, and contains only letters, digits, and underscores.
  • A name that is not allowed gets a red outline, with the reason under it.
  • Column names must be unique, and cannot be the name of a system column.
  • An input cannot change the table name or the source of a column.

Add columns​

ToDo this
Add a column from the responseOn the Response tab, select a value. A value that you can add shows + Add column.
Add a column by nameSelect Add column. In the Source picker, select a field that Preview found, or enter the exact field name.
Change the source of a columnSelect the source in the column. Edit JSON path lets you change the complete path.
Find the column of a valueSelect a mapped value or its column name, such as → country_name. This does not add a second column.
Empty a columnSelect Clear column in the menu of the column.

Good to know:

  • The column name comes from the field name. You can change it.
  • You cannot select an object or a list as a value. A value that you cannot add shows the reason when you point at it. To keep a complete object or list in one column, see Preserve a JSON value.
  • A path that starts with $ can use keys, quoted keys, fixed positions such as [0], and [*] for every item. Filters and expressions are not supported. A field name without $ is read as an exact name, also when it contains dots or brackets.
  • A Load job always keeps at least one column. An empty column is not saved.
  • A warning on a source means that the path is not valid or does not fit the Preview response. Select the warning to read why.

Choose what one row is​

By default, a JSON object gives one row, and a list at the top of the response gives one row for each item. For NDJSON, this applies to each line.

Rows, under the table name, shows the current choice, such as One row per item of abilities. Select it to:

  • Select a list that Preview found. Each list shows the number of rows that it makes in the sample.
  • Select one row per response.
  • Enter a JSON path that starts with $, for example for a list that is empty in the sample.

When you point at a value inside a list on the Response tab, buttons after the value show how you can use it. Selecting the value itself takes the first button.

ButtonResult
Every itemOne row for each item of the list. Existing columns move to the new rows.
Only item nThe column reads that one position in each record. The position and the field must exist in every record.
Align with rowsThe column reads item k of this list on row k. See Align parallel lists.

Good to know:

  • Nested lists work the same way. A value in a line of an order gives one row for each line ($.orders[*].lines[*]). An order without lines gives no rows.
  • A value from outside the rows repeats on each row. A badge says how: Same on every row, or for example Same per order.
  • A column that reads a list shows Each item, Aligned, or Item n. Select this label to switch.
  • Rows follow one chain of lists. When you add a value from another list, the column reads the position that you selected, and a notice offers Expand … instead. To load every item of two unrelated lists, use two Load jobs.
  • When a change makes a column read only the first item of a list, a notice says so and offers Undo.

Align parallel lists​

Some responses keep one record in several lists side by side: item k of one list belongs to item k of the others. An example is AWS CloudWatch GetMetricData, with the separate lists Timestamps and Values.

  1. On the Response tab, select a timestamp. Every item is the first button, so each timestamp becomes a row.
  2. Select a value in the parallel list, such as MetricDataResults[0].Values. Align with rows is now the first button.

You can also add and remove aligned lists under Rows.

In every response, each aligned list must have as many items as there are rows. Otherwise the load fails, in Preview and in a run. When you change Rows, Hypermeter removes the aligned lists that no longer fit, and a notice offers Undo.

For the job instructions, see Aligning peer arrays.

Read a value from the request instead of the response​

Some sources need one request for each resource, and the response does not name the resource. The request in the Extract job can carry that name in its metadata: block. The Load job reads it as a column.

  • On the Response tab, the keys are listed under Metadata, above the response body. Select a key to add a column.
  • Or open the Source picker of a column and select Metadata. You can enter a key before Preview has run. Select Response field to go back to a field.

Every row from one response gets the value of that response. A metadata column can be a key column. At least one column must read the response itself, because the response decides the number of rows.

If the Output tab shows Metadata unavailable, the Preview response did not keep its metadata. Run Preview again.

Set the types​

Select a Type for each column.

ForUse
TextTEXT, VARCHAR, or VARCHAR(n)
Whole numbersSMALLINT, INTEGER, or BIGINT
Money and other exact amountsDECIMAL(p,s), such as DECIMAL(38,12)
Approximate measurements, never moneyDOUBLE
Dates and timesDATE, TIMESTAMP (without an offset), or TIMESTAMPTZ (with an offset)
Other valuesBOOLEAN, UUID, BLOB, or JSON

Other spellings are rejected, for example STRING, JSONB, REAL, FLOAT, and DECIMAL without precision and scale. For the rules of each type, see Canonical types. For a date or time that is not in ISO 8601, see Dates and times in other formats.

SourceRule
JSON and NDJSONA column that is not DOUBLE or JSON rejects a number with a decimal point or an exponent that is not in quotes. Send an exact amount as text, such as "12.340000000000". If the source cannot do that, load the column as DOUBLE and cast it to DECIMAL in a Transform job.
JSON and NDJSONA column of the type JSON keeps a complete object or list, and the exact text of numbers. JSON null becomes null. A missing key fails the load.
ParquetA FLOAT, REAL, or DOUBLE column can go only to a DOUBLE column. An exact number column cannot go to a DOUBLE column. See The approximate type.
AllA DOUBLE column cannot be a key column. A value that is infinite or not a number fails the load.

Empty, missing, and wrong values​

A column is nullable or required. It can have a default, which is a fixed value or the time of the load. It can also have limits: a minimum and maximum for numbers and dates, and a maximum size for text and binary values. See Constraints and Defaults.

In the sourceColumnResult
Empty textNullableNull
Null or emptyRequired, with a defaultThe default
Null or emptyRequired, without a defaultThe load fails.
The field is missing in a rowRequiredThe load fails. A default does not help.
The field is missing in a rowNullableNull
The field is missing in every row of a responseNullableThe load fails, unless another mapped field of those rows is present.
A value with a wrong format, too long, or outside the limitsAnyThe load of the complete response fails.
A field without a columnNoneIgnored
An empty list as the rowsNoneNo rows

A JSON or NDJSON load also fails on invalid JSON, on data after the end of a JSON document, on an NDJSON line that is not one complete document, on a row that is not an object, and on a mapped key that occurs twice.

A very large object can exceed the limits of the check for repeated keys: 65,536 keys, or 8 MiB of key text. Select a smaller value, or split the source records.

Choose the key columns​

Select Key for every column that helps to identify one source row. A Load job needs at least one key column.

  • The same value gives the same key in every format, also when the source writes it differently.
  • The key uses the value of the source, before a default is applied.
  • Empty text and null are different keys. So are null and the text "null".

Rows with the same key​

Rows with the same key, below the columns, has two rules. Both start on Fail the run. Select Change beside a rule, select an option, and select Done.

When one run has the same key twice

OptionResultValue in the instructions (onDuplicate)
Fail the runThe run fails.reject
Keep the later rowThe later row stays.keep-last
Keep the earlier rowThe earlier row stays.keep-first
Keep one and warnOne row stays, and the run reports how many rows it dropped.report

When the key is already in the table

OptionResultValue in the instructions (onConflict)
Fail the runThe run fails.reject
Update to the newest dataThe newest row stays.keep-most-recent
Keep the stored rowThe row in the table stays.keep-existing
Always replace with this runThe row of this run stays.keep-incoming

To run a workflow again over data that is already loaded, select Update to the newest data.

Which row is later:

  • Between requests, the request lower in the Sources list is later. Repeats between two requests of the same Extract job follow the first rule. Repeats between requests of different Extract jobs follow the second rule.
  • Within one request, the order of the Extract job decides, not the moment at which a request finished.
  • When you start a run, you can change the order for that run under Producer order.

A row that stays keeps its first created_at. Its updated_at comes from the load that won.

What a run changes in the table​

  • A row with a new key is added. A row with an existing key follows When the key is already in the table.
  • Rows that the run does not bring stay in the table, also when the response is smaller or empty.
  • Hypermeter never loads earlier responses again by itself.
  • Changed columns apply to the next runs. The table continues when the column types and the key stay compatible. A change that is not compatible fails before anything is written. The error names the settings, and the table is not reset.
  • One wrong row or response stops the complete load. Nothing is written.
  • A Load job with an error stays editable, but you cannot preview it or publish it until you correct the error.

Besides your columns, the table has system columns such as created_at and updated_at. See Published schema.

Preview the Loader​

Select Preview to test the Load job with the same rules as a run. Preview does not change production data.

  • The Response tab shows the response of one request, with details such as 200 OK · JSON · 12 items · Captured 14:02. Use the request picker to select another source request.
  • The Output tab shows the rows from all source requests, with a summary such as 24 rows from 2 requests · 6 columns.

The Output tab shows one of two kinds of rows:

RowsCome fromShown when
Loaded rowsThe latest Preview. Each column shows its type.The rows match the current columns.
Draft rowsThe sample responses and the current columns, before types and same-key rules are applied. An NDJSON sample uses at most the first 8 documents.Preview has not run, or you changed the columns after the last Preview.
What you seeWhat it meansWhat to do
An amber dot on Output and a noticeThe columns changed since the last Preview.Select Run Preview.
A message that sample rows share a keyThe draft rows repeat the values of the key columns. The message says what a run does with them.Select Show rows, or Show these rows on the Output tab. Change the rule or the key if needed.
Draft rows unavailableDraft rows need a JSON or NDJSON sample that is not cut off.Select Preview to see loaded rows.
No destination tableThe table has no name.Enter a name in Table.

The check for repeated keys uses only the sample. It cannot see keys that earlier runs loaded.

For modes, limits, and history of Preview, see Preview Workbench.