Transformers
A Transform job uses SQL to create one table from the tables of earlier jobs. Use it to set the business grain, join and clean source data, and prepare the exact values that a Charge job calculates with.
For every key of the job instructions, see Transformer instructions.

The Transform job editor
| Part | Use it to |
|---|---|
| SQL | Write the statement that creates the table. |
| Checks | Add rules that the rows must pass. See Add checks. |
| Reads n | See the tables that the SQL reads, with the job or the workflow that writes each of them. The tables are grouped under This Workflow, Other Workflows, and Not wired. See Correct a table under Not wired. |
| Sources | See the columns and the rows of a table. Select the table name to see every table that you can read, and to insert one in the SQL. |
| Output | See the rows of the latest Preview. |
If Sources shows no table, open the job that this job reads, complete it, and select Preview there. If the tables fail to load, you see Table discovery is unavailable. Refresh to try again. Reload the page.
Your edits save to the draft by themselves, also when the SQL is not finished. Select Preview to run the job and its checks.
Write the SQL
The SQL dialect is DuckDB. Syntax that only PostgreSQL knows does not work. The statement has this form:
CREATE TABLE {{transformed}}."usage_summary" AS
SELECT account_id, SUM(quantity) AS quantity
FROM {{loaded}}."usage"
GROUP BY account_id;
| Placeholder | Stands for |
|---|---|
{{loaded}} | The tables of Load jobs |
{{transformed}} | The tables of Transform jobs, including the table that this job creates |
{{charged}} | The results of Charge jobs |
These rules apply:
- One job creates one table. A second output table is refused. Temporary tables inside the statement are allowed. A job with only checks creates no table.
- Read only the tables of jobs that this job reads, and declared sources. Files, URLs, and extensions are refused.
- Use the placeholders. A table written as
loaded.usageis an error. - Qualify a column with the table name or an alias:
budget.version, notloaded.budget.version. - Write
CREATE TABLE.OR REPLACEgives a warning and has no effect, because every run builds the table again. - Do not use
now(),current_date, orcurrent_timestamp. They give a warning, because a rerun with the same inputs can produce other rows. Declare aDateTimeinput with the value${{ now() }}and use it as:name. - Do not read the table that this job creates. See History and totals.
- Transaction statements are refused.
Use inputs in SQL
Write :input_name to use the value of an input:
SELECT account_id, usage_date, amount
FROM {{loaded}}.billing_lines
WHERE usage_date >= :start_date
AND usage_date < :end_date
- An input is always a typed value. It cannot change a table name, a column name, or a keyword.
- Put a name with a hyphen or a space in quotes:
':object-key'. Without quotes,:object-keyreads as:objectminuskey. - The values stay the same for a run and its retries.
See Inputs and parameters for how a value is chosen.
Preserve exact money provenance
A Charge job reads quantities and amounts only as BIGINT or DECIMAL(38,12), and it refuses approximate values. Use DECIMAL(38,12) for every exact value that goes to a Charge job.
In DuckDB, a division of decimals returns an approximate DOUBLE. A later cast to DECIMAL(38,12) does not make it exact again. A division of DECIMAL or integer values must therefore choose its result type where you divide. If it does not, the SQL is refused, and the message names the column and the line.
| You need | Do this |
|---|---|
| A division or multiplication that defines a billed value | Pass the exact operands to the Charge job and use Ratio or Product there. |
| A fixed conversion | Multiply by an exact decimal: microdollars * 0.000001. |
| An approximate ratio for analysis | CAST(used_capacity / NULLIF(total_capacity, 0) AS DOUBLE) |
| A division with a rounding rule | CAST(round_even(cost / NULLIF(quantity, 0), 12) AS DECIMAL(38,12)) |
- You choose the type once. Later steps, such as a CTE,
CASE, orUNION, pass the value on without a new cast. - A division of two approximate values needs no cast.
roundandround_evenover an exactDECIMALkeep it exact. - Other
DECIMALtypes stay valid for data that no Charge job reads.
See Currency values and decimal precision for joins, rounding, and currencies.
Prepare the table for a Charge job
Before a Charge job reads the table, make sure that:
- The table has one row for each business grain, and joins do not multiply rows.
- The identity columns of the grain are present and never empty.
- Each row has a start and an end as timestamps with a time zone, not as dates.
- Quantities, rates, amounts, and currencies keep the meaning of the source.
- An amount that you spread over rows still adds up to the source amount.
Leave volume pricing, graduated pricing, adjustments, and the final allocation to the Charge job.
If a date or identity column that a Charge job selects holds NULL in a row, the Transform job fails in Preview and in a run, and creates nothing. The message names the column. For other rules, add checks.
History and totals
A Transform job builds its table from its inputs on every run, so a rerun or a backfill gives the same result. SQL that reads the table of the job itself fails with transformer_self_read_not_supported. Use these patterns instead:
| You need | Do this |
|---|---|
| The history of a source that shows only its current state, such as a daily list of organizations | Keep one snapshot for each run. See the steps below. |
| More speed | Create a summary table at a coarser grain from the loaded data, and report on it in a second cube. |
| A running total, such as month to date or a balance | Calculate it in the cube with a rolling window or period-to-date measure. Do not store it as rows. |
To keep one snapshot for each run:
- In the request of the Extract job, stamp the run date:
metadata: { snapshot-date: '${{ date.format(now(), "%F") }}' }. - In the Load job, map it with
sourceAttributeto asnapshot_datecolumn of typeDATEthat is part of the row identity (compositeHash: true). The Load job keeps earlier rows, so each run adds one day. - In the Transform job, select the snapshot for each cost date.
A retry stamps the same date. Do not backfill such an Extract job: a backfill stamps the state of today with an earlier date.
Read the result of a Charge job
- Open Sources and select the table name at the top of the panel. A list opens with the tables of this workflow first, then the tables of other workflows.
- Search for the table of the Charge job in Search tables.
- Select Insert on the table. The reference appears at the cursor in the SQL, for example
{{charged}}."usage".

The list marks a table that this job already reads, and a table that this job cannot read because that would make a cycle.
To create the Charge job from here, write the reference to its table in the SQL first. Reads then lists the table under Not wired with no Job writes it. Select Create a Charger called with the name of the table. In Create Charger, check the Name and the Table name, and select Create and configure. The new Charge job has no cube and a monthly grain in UTC. Complete it, then select Back to Transformer.
- Insert adds the reference to the SQL and makes this job read the table. If you rename or remove a reference in the SQL, see Correct a table under Not wired.
- The source holds the complete result of the Charge job, each date once, as the latest calculation for that date wrote it. A field that the Charge job got later reads as
NULLfor dates that were calculated before. - To report on the table of this Transform job, give that table its own Charge job.
Read a table another workflow writes
Dependency arrows exist only inside one workflow. A Transform job can still read a loaded, transformed, or charged production table that another workflow writes, such as a weekly discount table.
- Open Sources and select the table name at the top of the panel.
- Find the table under the name of the workflow that writes it, and select Insert. The reference appears in your SQL, for example
{{transformed}}."discounts". Reads lists the table under Other Workflows with freshness at Publish, and the canvas shows the other workflow with a dashed arrow to this job. - Open the Review tab of the workflow. Under Issues, the job shows Choose how fresh this table from another Workflow must be. Choose a rule. There is no default, and you cannot publish before you choose.

| Rule | The run continues when |
|---|---|
| Any age | Always. You accept data of any age. |
| Newer than last run | The table is newer than at the last successful run of this job. The first run always passes. |
| At most N hours old | The table was written within the number of hours that you enter. |
After you choose, Reads shows the rule beside the table. With Any age, a run keeps succeeding when the other workflow stopped weeks ago. Hypermeter checks the rule in a run, not in a Preview. A run that fails the rule stops before it reads a row, and names the table and its age.
- A source is not a dependency: neither workflow waits for the other. Each run reads the table as it is when the run starts.
- Reads shows not published yet when the other workflow has no published version. Publish that workflow first.
- Reads shows not written yet when the table has no data. A Preview then needs a Preview of the other workflow, and a production run waits until the table is written.
- A table that a job in this workflow writes is listed under This Workflow, not under Other Workflows.
- SQL that reads a table that the job does not read is refused. So is a read that the SQL never uses. See Correct a table under Not wired.
- If the other workflow changes the columns or their types, your run fails before it reads a row.
- The editor warns when the table is gone or a different workflow writes it. A different writer does not block a run.
- A
loadedsource needs no Extract job or Load job in your workflow.
A Charge job reads tables of another workflow in the same way. See Chargers.
Correct a table under Not wired
When you type a table reference yourself, or change one, the SQL and the reads of the job can differ. The editor marks the reference, and Reads lists the table with the reason and an action:
| What Reads shows | What it means | What to do |
|---|---|---|
| A table without a writer, in the group of this workflow or of another workflow | This job does not read the table yet | Select Read from with the name of the job or the workflow |
| several writers | More than one job or workflow writes the table | Select Read from with the writer that you want |
| no Job writes it | No job writes a table with this name | Correct the name. For a charged table, you can select Create a Charger called with the name |
| cannot be read here | This job is not allowed to read the table | Read another table |
| reading it would make a cycle | The job that writes the table reads this job, directly or through other jobs | Read another table, or change the order of the jobs |
| not read | The job reads a table, or depends on a job, that the SQL no longer uses | Select Remove |
| Couldn't check whether this table is ready. Check again in a moment. | Hypermeter could not check the table | Select Check again |
Add checks
A check is a read-only query that returns the rows that break a rule. No rows means that the check passes.

-
Open the Transform job and select Checks.
-
Select Add check and enter a unique name.
-
Write the query. This one finds a grain that is not unique:
SELECT usage_date, account_id, line_idFROM {{transformed}}.fact_costGROUP BY usage_date, account_id, line_idHAVING count(*) > 1 -
Select Preview to run the job with its checks.
Remove check removes the selected check. The job instructions call checks assertions.
When checks run
Checks run in a Preview and in a run, before the job writes its table. If a check fails, the job fails and writes nothing. Validation refuses a check that is not read-only, but it reads no rows.
A check that passes in a Sample Preview proves the rule for that sample only. Full validation covers the complete data of that Preview. Neither proves anything about later runs.
A failed check appears in the results of the job, and Open check selects it. The run shows one of two causes:
| What you see | What it means | What to do |
|---|---|---|
assertion_violation | The check returned rows that break its rule. | Fix the SQL that makes those rows, or change the check. |
assertion_execution_failed | The check could not run. It says nothing about your data. | Read the evaluation cause below. |
| Evaluation cause | What it means | What to do |
|---|---|---|
out_of_memory, resource_limit, timeout | The check needed too much memory, working space, or time. | Filter or aggregate earlier, or check a narrower range. A retry without a change fails again. |
invalid_query | The SQL of the check is invalid, or it names something that does not exist. | Fix the SQL of the check. |
data_error | A value could not be converted. | Fix the conversion, or the data. |
source_access | An input could not be read. | Check that the inputs of the run are published and readable. If it happens again, contact support. |
connection_lost | The check lost its connection. The check is not necessarily the cause. | Restart the failed jobs. If several jobs fail at once again, contact support. |
shared_memory_pressure | The check was stopped to free memory for other work. | Restart the failed jobs later. |
unknown | The cause was not recorded. | Read the error log of the job. |
Inspect the rows of a failed Production check
- Open the run and open the failed Transform job.
- Select Show failing rows.
You need the rows data access level. The run_check_evidence_get tool reads the same evidence.
Hypermeter runs the check again on exactly the data that the run read, and changes nothing. You see:
- The SQL of the check as it was in the published version that ran.
- Up to 100 of the returned rows, and their exact number. If the count takes too long, it is reported as not computed.
- For a check that reads the table of the job: the rows for the first keys that failed, with the columns that hold more than one value for a key.
Values keep their exact text: every digit of a DECIMAL, NULL, and "" for empty text. Copy rows copies the rows as CSV.
The rows are not available when:
- The check could not run. You see
check_sql_failedorcheck_not_evaluatedwith the cause, and the SQL of the check. - The data that the run read is no longer kept.
- The check uses a masked or secret input.
- The job no longer matches the published version that ran.
- The check failed in a Preview. Run the Preview again.
Make a check explain its failures
A check fails when it returns a row, whatever the row holds. The columns are what you see when you inspect the failure, so SELECT 1 shows only how many rows failed. Return the columns that identify the row, and for a comparison both values and their difference:
SELECT
usage_date,
value_status,
projected_cost AS actual,
forecast_cost AS expected,
projected_cost - forecast_cost AS difference
FROM {{transformed}}.cost_outlook_daily
WHERE projected_cost IS DISTINCT FROM forecast_cost
Keep DECIMAL values as DECIMAL, so that the difference is exact.
Fix SQL errors
If a Preview cannot run because of the SQL, open the failed Preview control and select Open SQL error for the job. The editor selects the text with the problem and explains it.
| What you see | What to do |
|---|---|
| A missing table | Open Reads and follow the action for the table. See Correct a table under Not wired. |
| A missing column | The message names the column and can suggest others. Compare with the columns in Sources. |
| A Charge job reports that it is blocked | Fix the error in the job that it reads first. |
| In a run, an output column has another type than expected | Read the log of the job. It names the column and both types. |
After an edit, select Preview again: the positions of earlier errors no longer match the text. A job with invalid SQL cannot be published.
A JSON expression gives a JSON column. If a later job needs text, use CAST(... AS VARCHAR).
Technical notes
Under Technical details, the Review tab lists notes about SQL that can make a run slow. A note blocks nothing, and a job without notes can still need too much memory or time.
| Note | What it means | What to do |
|---|---|---|
transformer_row_multiplier | A cross join, a join without an equality condition, or an unnest can return more rows than its inputs. | If rows should match on a column, join on that column. |
transformer_unbounded_read | The query reads the complete history of a loaded table, or of a table of another workflow, on every run. | Filter by the run period, for example WHERE usage_date >= :start AND usage_date < :end. |