Hydra ETL
Build your first job
Hydra DSL7 · Expressionscalculate.expr
Grammar element · calculate.expr

calculate.expr produces one named column

Three valid pandas-eval expressions. The output name and the formula stay separate.

transformations.yaml4 steps

      
What the expression produces

One new or replaced column, with one value for every current row.

✓ 30 values calculated

What calculate.expr is

calculate.expr is the formula used to produce one named output column from the current frame.

It does not filter rows and it cannot declare several outputs at once. Use separate calculate steps or a script with an explicit output mapping.

What it contains

  • Current column references — Names available when the step begins.
  • Arithmetic expression — Evaluated by pandas eval with the Python engine.
  • One destination column — Declared separately by calculate.column.

Name the output outside the formula

Separating column from expr makes assignment explicit. A reader can identify what changes without parsing the expression text.

Calculate expression maps current columns to one output The current amount value is multiplied by 1.2 and assigned to amount_with_tax. amountcurrent float amount * 1.2calculate.expr amount_with_taxnamed column Every current row remains; each receives one calculated value.
The formula computes; column names the destination.

Run the complete example

Copy this manifest from the verified documentation project, then run it from the repository root.

version: "1.0"
transformations:
  steps:
    - cast:
        mapping: {amount: float}
    - calculate:
        column: amount_with_tax
        expr: "amount * 1.2"
hdrctl run examples/tutorial/dsl-elements -t compute.yaml
  ✅ Pipeline completed successfully in 2.9s
  Rows read   : 30
  Rows written: 30

The relevant command syntax, copied from hdrctl run --help:

hdrctl run [PATH]
  -s, --sources FILE          explicit path to sources.yaml
  -d, --destinations FILE     explicit path to destinations.yaml
  -t, --transformations FILE  explicit path to transformations.yaml
  -P, --param KEY=VALUE       override a parameter, repeatable

Close by

0 / 0 on this page