Skip to main content

Loader instructions

Loader instructions define one mapping from the artifacts that an Extract job fetched to one loaded table. The same instructions run in Preview and Production. To build a Load job in the app, see Loaders.

Top-level keys​

KeyRequiredMeaning
$schemaNoUse https://hypermeter.com/loader.schema.json.
targetRelationYesOne static identifier of the loaded table.
authoringVersionYes for new templatesUse 2 for current source and nested mapping behavior.
rowSelectorNoJSON path that selects one object or a repeated row collection.
alignedRowSelectorsNoFurther row collections, aligned by position with rowSelector. At most 15 entries.
columnsYesOne or more literal field or JSON path mappings.
parametersYesServer-owned parameters. Use an empty list when none apply.
onDuplicateYesPolicy for equal identities inside one extraction batch.
onConflictYesPolicy for an identity across extraction batches or generations.

These keys are not accepted: allowedFamilies, sourceType, table, source, format, and the nested reference block with fromContent and fromAttributes. Use sourceField, sourcePath, sourceAttribute, or sourceColumn instead.

Workflow source bindings​

The instructions do not select Extractor requests. The Load job keeps that ordered source list. For authoringVersion: 2, each source binding identifies one request on a direct Extractor dependency:

loader_source_requests:
- producer_logical_job_id: extract-invoices
extractor_request_name: invoice-lines

Do not add source_semantics to current bindings. Saving a selected request also enables its Load setting.

Artifact families and source fields​

FamilyRequired source shapesourceField meaning
CSVHeader-based rowsExact header name
JSONOne object, an object array, or selected nested rowsExact case-sensitive key of each selected row
NDJSONOne document per physical line, with the selector applied to eachExact case-sensitive key of each selected row
PARQUETNative Parquet rowsExact physical column name
XMLRows selected with rowSelectorNot used. Map with sourcePath.

Hypermeter selects the reader from each artifact. Database requests produce CSV. HTTP and object requests support all five formats. Text and binary artifacts are refused. The same field mapping applies to every selected source.

sourceField is a literal key. For nested JSON, NDJSON, or XML data, use sourcePath with rowSelector:

authoringVersion: 2
rowSelector: $.results[*]
# Include the normal output type, constraints, and identity settings for each column.
columns:
- sourcePath: $.results[*].species.name
outputColumn: species_name

Path rules:

  • A path supports $, object keys, JSON-quoted keys, fixed nonnegative indexes, and [*].
  • Every wildcard in a column path must follow the ancestor chain of one declared row collection. A field can read row ancestors or document metadata.
  • Filters, expressions, and recursive descent are not supported, and neither is an array that no declared row collection covers.
  • A path has at most 64 steps and 8192 UTF-8 bytes. A key has at most 1024 UTF-8 bytes, without NUL. Indexes range from 0 through 2147483647.

XML:

  • The Loader reads XML as one JSON document. Every child element is an array under its local name, an attribute is "@name", the text of an element is "#text", and every value is a string. See XML response bodies.
  • XML needs authoringVersion: 2 and a rowSelector.
  • An XML artifact can be at most 8 MiB and 31 elements deep. A document type definition, an encoding other than UTF-8, or malformed XML is refused.

Missing fields:

  • A non-nullable mapped field must exist in every selected row.
  • A nullable field may be absent from a row, unless its column stores raw JSON. It then reads NULL, so a default still applies.
  • A nullable field that is absent from every row of an artifact is refused, unless another mapped field of the same row level is present.

Aligning peer arrays​

Declare parallel arrays with alignedRowSelectors. Row k then reads element k of every declared collection. For the editor, see Align parallel lists.

authoringVersion: 2
targetRelation: volume_performance
rowSelector: $.MetricDataResults[0].Timestamps[*]
alignedRowSelectors:
- $.MetricDataResults[0].Values[*]
- $.MetricDataResults[1].Values[*]
columns:
- sourcePath: $.MetricDataResults[0].Timestamps[*]
outputColumn: metric_date
typeName: TIMESTAMPTZ
constraints: {}
nullable: false
primaryKey: true
compositeHash: true
- sourcePath: $.MetricDataResults[0].Values[*]
outputColumn: read_ops
typeName: DOUBLE
constraints: {}
nullable: false
primaryKey: false
compositeHash: false
  • Alignment is never inferred. Two arrays that the instructions do not align produce an error.
  • Every declared collection, rowSelector included, must expand exactly one array as its final step.
  • You can declare at most 16 distinct collections in total, and none inside an already aligned collection.
  • Aligned elements may be scalars, such as a Timestamps array of strings. Without an aligned collection, each selected row must be an object.
  • Within one document, every declared collection must hold the same number of elements. A collection that is absent, is not an array, or has a different length is refused in Preview and in Production, and nothing is loaded.
  • A column mapped without a wildcard repeats unchanged on every aligned row.

Artifact metadata columns​

sourceAttribute names one key from the metadata block of the Extractor request. Every row read from an artifact receives the value of that artifact. See Read a value from the request instead of the response.

authoringVersion: 2
columns:
- sourceField: Average
outputColumn: average_read_bytes
typeName: DECIMAL(38,12)
constraints: {}
nullable: false
primaryKey: false
compositeHash: false
- sourceAttribute: volume_id
outputColumn: volume_id
typeName: TEXT
constraints: {}
nullable: false
primaryKey: false
compositeHash: true
  • sourceAttribute requires authoringVersion: 2. It needs no rowSelector, so it works for CSV, Parquet, JSON, and NDJSON.
  • The key is an exact literal string of at most 1024 UTF-8 bytes, never a path, selector, expression, or pattern. Metadata keys and content field names do not collide: one column can read content field volume_id and another the metadata key volume_id.
  • The value can be any text, including an object key or a URL such as openshift/20260910_OpenShift.csv. It is loaded as a value and never opened as a file. The text is converted to the column type, and the physical-type checks for Parquet content columns do not apply.
  • A metadata value never creates, removes, or multiplies a row. A definition that maps only metadata is refused at compile time.
  • When an artifact has no value for the key, a nullable column reads NULL for every row of that artifact. A non-nullable column refuses the load and names the artifact, the key, and the output column.
  • An empty string value stays an empty string, distinct from an absent key in unique_hash.
  • The Extractor refuses a metadata key that is empty, has surrounding whitespace, exceeds 1024 bytes, or reads like a credential or a source URL.

For non-JSON destination columns, encode exact decimals as JSON strings. These columns reject objects, arrays, decimal-point tokens, exponent tokens, and negative zero.

Preserve a JSON value​

Use typeName: JSON to keep a selected object or array. Nested arrays stay inside the value. They do not create additional rows.

authoringVersion: 2
targetRelation: response_documents
rowSelector: $.values[*]
columns:
- sourcePath: $.values[*].resourceid
outputColumn: resource_id
typeName: TEXT
constraints: {}
nullable: false
primaryKey: true
compositeHash: true
- sourcePath: $.values[*]
outputColumn: payload
typeName: JSON
constraints: {}
nullable: false
primaryKey: false
compositeHash: false
parameters: []
onDuplicate: keep-last
onConflict: keep-incoming

This mapping stores each complete response object in payload, and downstream SQL can query its nested properties and arrays. A literal sourceField with typeName: JSON also preserves the complete field value.

  • JSON columns also preserve strings, booleans, fractional numbers, exponent numbers, and large integers. Number text is kept without rounding. Empty objects and arrays are valid values.
  • A missing path fails for a JSON column, also when it is nullable.
  • JSON null becomes SQL NULL and requires a nullable column. The strings "" and "null" remain JSON strings.
  • Invalid JSON and duplicate keys inside a stored value fail the load.

Count an array without storing it​

Set arrayLength: true on a sourcePath column with typeName: BIGINT to load the number of items in the array at that path instead of the items. An empty array loads 0 and keeps the row. This gives one receipt row per response, also for an empty response:

authoringVersion: 2
targetRelation: metric_batches
rowSelector: $
columns:
- sourceAttribute: request_scope
outputColumn: request_scope
typeName: TEXT
constraints: {}
nullable: false
primaryKey: true
compositeHash: true
- sourcePath: $.values
arrayLength: true
outputColumn: returned_resources
typeName: BIGINT
constraints: {}
nullable: false
primaryKey: false
compositeHash: false
parameters: []
onDuplicate: reject
onConflict: keep-most-recent

A missing array, an object, a scalar, or null fails the load. With a nullable column, a missing array or null loads NULL. Under a row selector such as $.values[*], $.values[*].value with arrayLength counts the array of each row.

Column keys​

KeyRequiredMeaning
sourceFieldExactly one source per columnOne exact source field.
sourcePathExactly one source per columnSupported JSON path, with authoringVersion: 2 and rowSelector.
sourceAttributeExactly one source per columnOne metadata key of the artifact, with authoringVersion: 2.
sourceColumnExactly one source per columnOne physical CSV column selected by index, prefix, or pattern, with authoringVersion: 2.
outputColumnYesUnique target column identifier.
typeNameYesOne canonical Loader type.
constraintsYesValue constraints. Use {} when none apply.
nullableYesWhether the output can be null.
defaultValueNoOne typed literal or server parameter reference.
formatNostrptime pattern for a DATE, TIMESTAMP, or TIMESTAMPTZ value that is not ISO 8601, with authoringVersion: 2. See Dates and times in other formats.
arrayLengthNoWith sourcePath and typeName: BIGINT, loads the length of the array instead of a value. See Count an array without storing it.
primaryKeyYesPreview Capture metadata only.
compositeHashYesAdds the column to the Production row identity.

At least one column must set compositeHash: true, and at least one column must read the record itself with sourceField, sourcePath, or sourceColumn.

CSV column selectors​

sourceColumn selects one physical CSV column without spelling its name. It has exactly one of three arms and requires authoringVersion: 2.

columns:
- sourceColumn: { prefix: "lineItem/UnblendedCost" }
outputColumn: cost
typeName: DECIMAL(38,12)
constraints: {}
nullable: false
primaryKey: false
compositeHash: true
ArmMatches
indexThe column at that zero-based position.
prefixA column name that starts with the literal. Every character is compared literally.
patternA column name that the RE2 pattern matches in full.
  • A definition that uses sourceColumn reads its source as CSV, also when an HTTP or bucket source can send several file formats. A source that cannot deliver CSV is refused.
  • Matching is anchored and case sensitive: cost does not match cost_usd, and cost.* does. For case folding, use the RE2 inline flag: (?i)cost.
  • A selector must resolve to exactly one column, and to the same physical column in every artifact of one load. Otherwise the load is refused. The error names every candidate, or lists the observed column names when nothing matches.
  • Any index selector makes the definition headerless: the first physical row of the artifact is data. A definition that mixes a position with a name-based source is refused.

Canonical types​

TypeContract
BOOLEANBoolean
TEXTUTF-8 text
VARCHARUTF-8 text without an authored width
VARCHAR(n)UTF-8 text with n from 1 through 1,048,576
SMALLINTSigned 16-bit integer
INTEGERSigned 32-bit integer
BIGINTSigned 64-bit integer
DECIMAL(p,s)Exact decimal with precision 1 through 38 and scale 0 through p
DOUBLEApproximate binary floating-point measurement
DATEISO calendar date
TIMESTAMPISO timestamp without an offset
TIMESTAMPTZRFC 3339 timestamp with an offset
BLOBBinary bytes
UUIDCanonical UUID text
JSONJSON text

PostgreSQL aliases and incomplete decimal types are rejected. DOUBLE is the only approximate type: REAL, FLOAT, FLOAT4, FLOAT8, and DOUBLE PRECISION are rejected, and the diagnostic names DOUBLE as the accepted spelling.

Dates and times in other formats​

DATE, TIMESTAMP, and TIMESTAMPTZ read ISO 8601 text unless the column declares a format. Azure Cost Details, for example, writes its date field as 09/24/2026:

authoringVersion: 2
columns:
- sourceField: date
outputColumn: usage_date
typeName: DATE
format: "%m/%d/%Y"
constraints: {}
nullable: false
primaryKey: false
compositeHash: true

The format is a DuckDB strptime pattern. Supported specifiers are %Y (2026), %y (26), %m and %-m (month number), %d and %-d (day), %b and %B (month name), %a and %A (weekday name), %j (day of the year), %H, %-H, %I and %-I (hour), %p (AM or PM), %M and %-M (minute), %S and %-S (second), %g, %f and %n (milli-, micro- and nanoseconds), %z (UTC offset such as +0200) and %% (a literal percent sign). Any other character must appear exactly.

  • A value that does not match the format fails the load with Could not parse string "..." according to format specifier "...". Empty text loads as null. Without a format, a non-ISO value fails with Conversion Error: invalid date field format.
  • A TIMESTAMPTZ format must contain %z. A DATE or TIMESTAMP format must not. Use TIMESTAMP for a time that carries no offset.
  • A sourceAttribute column cannot declare a format.
  • A format column mapped by sourceField can still be the time field that lets a complete source, such as a finished Azure Cost Details report, replace its days in the table instead of merging into them.

The approximate type​

DOUBLE is for a measurement that was never exact, such as a utilization percentage, a latency, or a score. Never use it for money.

  • A Parquet FLOAT, REAL, or DOUBLE field feeds only a DOUBLE column. A mapping to DECIMAL(p,s), BIGINT, TEXT, or any other type is refused before a row is read. The diagnostic names the field, its observed type, the output column, and DOUBLE as the remedy.
  • A DOUBLE column accepts a Parquet approximate field, a Parquet text field, or a delimited, document, or artifact-metadata source. A Parquet exact numeric, boolean, temporal, or binary field is refused.
  • A Parquet list, struct, or map with a floating-point member, such as DOUBLE[], STRUCT(x DOUBLE), or MAP(VARCHAR, DOUBLE), is refused for every column type. Flatten the source to one approximate field and declare DOUBLE.
  • A DOUBLE column cannot be a compositeHash participant or a primaryKey.
  • Every DOUBLE column is checked for a finite value, and you cannot switch this off. A source cell that converts to infinity or to not-a-number fails the artifact with a diagnostic that names the column, and no row of that artifact is published.
  • Exact minimum and maximum bounds are not supported on DOUBLE.
  • Write a DOUBLE default as canonical decimal text in decimalValue. Exponent, NaN, infinity, and negative-zero spellings are rejected.

Constraints​

KeyApplies toMeaning
minimumExactIntegers, decimals, dates, timestampsInclusive canonical minimum
maximumExactIntegers, decimals, dates, timestampsInclusive canonical maximum
maximumTextBytesTEXT, VARCHAR, UUID, JSONMaximum UTF-8 byte count
maximumBinaryBytesBLOBMaximum byte count
finiteOnlyDECIMAL(p,s), DOUBLERefuses a non-finite source value

finiteOnly always applies to a DOUBLE column, so you do not need to declare it there. On a type that is not listed for it, it is rejected. A default is validated against the same constraints.

Defaults​

defaultValue contains exactly one source: literal or parameterName.

Use literal for a typed value:

defaultValue:
literal:
decimalValue: "0.000000000000"

The literal object accepts exactly one of these keys: nullValue: true, booleanValue, textValue, integerValue, decimalValue, dateValue, timestampValue, or bytesValue.

Integer and decimal values are strings. bytesValue uses base64. JSON columns accept only a null literal default, and only when nullable.

Use parameterName for a declared server parameter:

parameters:
- name: load_instant
typeName: TIMESTAMPTZ
nullable: false
policy: pinned-load-instant

columns:
- sourceField: observed_at
outputColumn: observed_at
typeName: TIMESTAMPTZ
constraints: {}
nullable: false
defaultValue:
parameterName: load_instant
primaryKey: false
compositeHash: false

pinned-load-instant is the only parameter policy. It requires a non-null TIMESTAMPTZ parameter.

Duplicate and conflict policies​

onDuplicate applies to equal hashes within one extraction_batch_id.

ValueMeaning
rejectFail the batch collision.
reportReport the repeated identity without selecting a policy-specific survivor.
keep-firstKeep the earliest row by recency.
keep-lastKeep the latest row by recency.

onConflict applies after one survivor remains from each extraction batch.

ValueMeaning
rejectFail a cross-batch or existing-generation collision.
keep-existingKeep the published row.
keep-incomingKeep the incoming row.
keep-most-recentKeep the greatest recency tuple.

The recency tuple is (job_execution_id, load_sequence, source_ordinal). The retained row keeps the earliest created_at for its identity.

Published schema​

The Loader publishes your columns in instruction order, then these system columns:

unique_hash BLOB
job_execution_id BIGINT
extraction_batch_id TEXT
source_artifact_id TEXT
created_at TIMESTAMPTZ
updated_at TIMESTAMPTZ
load_sequence BIGINT
source_ordinal INTEGER

All system columns are non-null. unique_hash stores the raw 32-byte SHA-256 value.

Example​

$schema: https://hypermeter.com/loader.schema.json
targetRelation: invoice_lines_raw
parameters: []
onDuplicate: reject
onConflict: keep-most-recent
columns:
- sourceField: invoice_id
outputColumn: invoice_id
typeName: TEXT
constraints:
maximumTextBytes: 256
nullable: false
primaryKey: true
compositeHash: true

- sourceField: line_id
outputColumn: line_id
typeName: TEXT
constraints:
maximumTextBytes: 256
nullable: false
primaryKey: true
compositeHash: true

- sourceField: cost_amount
outputColumn: cost_amount
typeName: DECIMAL(38,12)
constraints:
finiteOnly: true
nullable: false
primaryKey: false
compositeHash: false

- sourceField: cpu_utilisation
outputColumn: cpu_utilisation
typeName: DOUBLE
constraints: {}
nullable: true
primaryKey: false
compositeHash: false

- sourceField: currency
outputColumn: currency
typeName: VARCHAR(3)
constraints: {}
nullable: false
defaultValue:
literal:
textValue: USD
primaryKey: false
compositeHash: false

Contract changes​

A change to a mapping, type, constraint, default, null policy, identity, duplicate policy, conflict policy, or output creates a new contract.

  • The new mappings apply to later runs. History is not reprocessed, and the table is not replaced.
  • With a compatible output structure and record identity, rows continue into the existing table. Incoming matches use onConflict, new identities insert, and unmatched historical rows remain.
  • Incompatible column types, nullability, or record-identity policies fail before publication.