Skip to main content

Extractors

An Extract job fetches raw data from an API, a database, or cloud storage. It holds one or more requests, and each request is one fetch. A Load job then maps the responses into a table.

This page shows how to build requests in the Extract job editor. For every key that the job instructions accept, see the Extractor instructions reference.

An Http request in the Extract job editor.
An Http request in the Extract job editor.

Add a request​

  1. Open the Extract job from the Build tab of the workflow.
  2. Select Add request and select the kind of request.
  3. Enter a readable name, such as Fetch Customer Accounts.
  4. Fill in the first tab of the request.
  5. Select Done.
KindReadsFirst tab
HttpAn HTTP or REST APIRequest: the Method and the Request URL
QueryThe result of a SQL query on a databaseQuery: the database engine and the SQL
TableA complete database tableTable: the database engine and the table name
StorageOne object in cloud storageStorage: the provider and the location of the object

The editor saves your changes by itself, also when a request is incomplete. You can rename a request later: references to it keep working.

For all sources and formats, see Data sources.

Http​

Select a Method (GET, PUT, POST, PATCH, DELETE, or OPTIONS) and enter the Request URL. Add headers on the Auth & Headers tab and a body on the Body tab.

The response can be CSV, JSON, NDJSON, or Parquet. Hypermeter detects the format. You do not set it.

Query and Table​

Both kinds read from PostgreSQL, MySQL, MariaDB, SQL Server, or Oracle, and always produce CSV.

SELECT account_id, service, cost, usage_date
FROM billing.line_items
WHERE usage_date >= '${{ inputs.start_date }}'
  • Write a query in the SQL dialect of the source database. This is not the SQL of a Transform job.
  • Format SQL formats the query. It does not check it.
  • A Table request takes one table name, such as billing.line_items. Use a Query request when you need filters or joins.
  • Use a read-only database user when the source allows it.

Storage​

Select the provider and enter the location of the object: a bucket and a path for Amazon S3 or Google Cloud Storage, or a container and a blob for Azure Blob Storage. Amazon S3 also takes a region and an optional custom endpoint.

The object can be CSV, JSON, NDJSON, or Parquet.

Sign in to the source​

A request signs in with an authenticator: a named set of credentials that you create once and attach to requests by name. An Http request has it on the Auth & Headers tab. A Query, Table, or Storage request has a Connection tab, which lists only the types that fit the selected database or provider.

See Connections and authentication.

Find your way in the editor​

The editor shows each request as a card. Each named output is a token between the request that produces it and the requests that use it.

  • Select the edit icon of a request to open it.
  • Select a token to open the Outputs tab of the request that produces it.
  • Select Arrange graph to tidy the layout.
LineMeaning
SolidThe request runs after the request that produces the value.
DashedThe value is a list, and the request runs once for each item.
DottedThe value is inserted into a field or used for pagination.

Use values in a request​

A request field can contain expressions:

${{ inputs.account_id }} # a workflow input
${{ outputs.account_token }} # a value from an earlier response
${{ matrix.region }} # the current value of a matrix

Expressions can also call functions such as default, if, and helpers for text, numbers, and dates. See Template expressions and functions.

After a request previews successfully, autocomplete suggests the paths that Preview found in its response, such as outputs.invoices[0].id.

Convert to input​

To turn a fixed value into a workflow input:

  1. Select the value in the field.
  2. Select Convert to input in the tooltip, or press Mod-Shift-I.
  3. Confirm or change the suggested name.

The editor replaces the value with ${{ inputs.<name> }}. The value becomes the default of the new input. You can also type a new name in autocomplete and select Create input.

The same action works in the fields of an authenticator that are not secret. See Convert other fields to inputs. For types, defaults, and the value that a run uses, see Inputs and parameters.

Use response data in another request​

A request often needs a value from an earlier response, such as a token or a list of account IDs.

  1. Put the cursor in the field that needs the value.
  2. Select Response sample on the earlier request. The sample opens in the Data panel.
  3. On a value, select Insert for one value or Repeat for a list.

Instead of steps 2 and 3, you can open the insert menu of the field and select a path under Responses.

Hypermeter creates the output and saves it. Good to know:

  • One value is inserted at the cursor. A list makes the request run once for each item.
  • In a list of objects, select the property that you need. Selecting name under results[0] uses every results[].name value. You cannot insert a complete object into a URL, query, table name, header, or storage field.
  • This works in URLs, bodies, queries, table names, header values, and storage fields. The response headers that Preview shows are also listed under Responses.
  • When no field is active, select Use elsewhere on a value. You can create a request, update a request, or keep the value as a reusable output.
  • Hypermeter blocks a reference from a request to itself, and a circle of requests.
  • When you delete a request, Hypermeter removes the references to its outputs. It also removes outputs of earlier requests that only the deleted request used.

Choose an output accumulation kind​

An output can match more than one value in a response. On the Outputs tab, each output has a kind that decides how the matches are stored. Point at a kind to see an example.

KindWhat it stores
AutoOne value. From the second match on, a list.
SingleExactly one value. A second match fails the request.
ListAlways a list, also for zero or one match.
Map (auto)A map by key. One value for each key, or a list when a key repeats.
Map (single)A map with one value for each key. A repeated key fails the request.
Map (list)A map with a list of values for each key.

The map kinds need a key expression. Use Single or Auto for a value that goes into a URL. Use List or a map kind for a value that a request repeats over.

For the keys in the job instructions, see Outputs.

Repeat a request​

Once for each value (matrix)​

A matrix runs the same request for every combination of one or more lists of values, for example for each region and each account.

GET https://api.example.com/v1/cost?region=${{ matrix.region }}&account=${{ matrix.account }}

With two regions and three accounts, this request runs six times. A matrix belongs to one request. One list of the matrix can depend on another.

When a field uses a list output and the request has no matrix yet, the editor can offer Convert to matrix. It adds the list to the matrix and changes the reference to matrix.<key>.

Follow pagination​

When a response says where the next page is, the request can repeat until the source has no more pages.

  1. Open the Repeat tab of the request.
  2. Select the source: the value in the response that points to the next page.
  3. Select the destination: where that value goes in the next request.
  4. Select Close. Your changes are already saved.

You can also start from a Preview response. Select the value and select Configure pagination, Configure next query, Configure next table, or Configure next object, depending on the kind of request. Hypermeter saves the path of the value, not the value itself, and opens the Repeat tab.

The editor shows Needs destination or Needs attention until the settings are complete. Remove continuation deletes them.

KindWhere the next-page value can come fromWhat the next request can change
HttpThe body, a response header, or a Link header relationURL, query parameters, headers, body, and authentication options
QueryThe bodyThe complete SQL query
TableThe bodyThe table. It does not page through rows.
StorageThe bodyThe object or blob. It does not list a bucket or container.

Rules:

  • The request stops when the value is missing, null, or empty. You do not need a condition for that.
  • Add a continueWhen condition only when the response has a separate flag that says whether more pages exist. It must return true or false. Any other result fails the request.
  • A relative next URL is resolved against the URL of the current response. It must stay on the same origin.
  • To read several independent tables or objects, use a matrix.

See Pagination.

Run a request conditionally​

On the Advanced tab of a request, enter an if condition under Condition. When the condition is false at run time, the request is skipped.

${{ if(inputs.include_detail, true, false) }}

Decompress responses​

When the source returns a compressed response, open Decompression on the request and select Gz or Zip. The default is None. The Load job then reads the unpacked content.

Every file in a zip archive becomes its own response for the Load job, in the order of the archive. Folders are skipped.

What you seeWhat it meansWhat to do
The request fails on an archive with several filesThe request reads its own response body, for an output or for pagination. That needs an archive with one file.Use an archive with one file.
An error that says that the zip archive is emptyThe archive has no files, or only folders.Check the archive at the source.
An error that names a limit and a number of entriesThe archive has more than 10,000 files. You cannot raise the limit.Use archives with fewer files.

Handle errors and retries​

For an Http request, open the Advanced tab. Under Error handling, set one action for each Status code pattern, such as 4xx or 503. Query, Table, and Storage requests have no error handling.

ActionWhat happens
AbortThe request stops and fails. This is the default for every status that you do not handle.
IgnoreThe response counts as handled and the job continues.
RetryThe request tries again with a growing delay, and fails when the attempts run out.

For Retry, you set the number of attempts and the delays. A retry can also wait as long as the source asks in the Retry-After header, or in another header that you name.

See HTTP error handling.

Decide what gets loaded​

Each request has a Load switch. When it is on, a Load job can use the response. It is on for new requests.

  • Turn Load off for a helper request, such as a request for a token. Its outputs stay available to later requests.
  • You cannot turn Load off while a Load job uses the request. Remove the request from the sources of that Load job first.
  • Turning Load on does not add the request to an existing Load job. See Choose the source requests.

Preview the requests​

Preview calls the source and shows the responses. Check your sign-in, outputs, and pagination here before you add a Load job.

To previewDo this
One requestSelect the play icon on the request. Hypermeter also runs the earlier requests that it needs.
The complete Extract jobSelect Preview, then Confirm and run.

A request shows Preview running until its result is ready. You can cancel it, and you can preview another request in the meantime.

A successful request shows a summary such as 200 OK · CSV · 549 items. Select Response sample to open the response in the Data panel:

  • Body shows the response. Select an object or a list to expand it.
  • Headers shows the response headers that are safe to show.
  • Page appears when the request returned more than one response.
  • Copy body copies the body, and Copy headers copies the headers. The menu of a value has Copy value and Copy path.
What you seeWhat it meansWhat to do
Preview limit reached · more source pages existThe sample succeeded and the source has more pages than the sample fetched.Nothing.
Last pageThe source returned no value for a next page.Nothing.
Stopped by conditionThe stop condition of the pagination ended the request.Nothing.
Preview unavailable on a requestA field uses an object or a list where it needs one value.Select the action that names the field, such as Set request URL.
An error on one requestThat request failed. The message gives the cause, without credentials.Correct the request, then select its play icon. Copy error details copies the message.
A request that names an earlier requestThe earlier request failed, so this one did not run.Correct the earlier request.
The result says that execution stopped, or that the result cannot be readPreview did not finish.Select Run Preview again.
Preview for the complete job is unavailableA request is incomplete, or the Preview of a request is still running.Complete the request, or wait.

To see earlier results and keep the ones you need, open the ⋮ menu and select Preview history. For modes, limits, and inputs of Preview, see Preview Workbench.

Tell Preview what a request does​

Preview calls the real source, so each request has a Source effect. A new request shows Effect unknown, and Preview asks you to choose. You can also select the label on the request and choose there. See Say what a request does.

ChoiceValue in the instructions
Reads or exports dataread_export
May change source databusiness_mutating
I am not sureunknown. The request stays Effect unknown, and each live Preview asks you to confirm.

For a request that may change source data, use retained source data or an endpoint that is not production.

After you choose, Hypermeter asks again only when you change the host or path, the method, a header, the credentials, or the SQL. A change of the period or of another plain value, such as an ID in the URL query, does not count.