base.mutate

Add or replace columns computed from SQL scalar expressions over the input table. Each expression is evaluated with Polars' SQL engine and assigned to a named column; a name that already exists is replaced, a new name is appended. Covers unit conversions, key parsing, interaction terms, and NA-filling (via COALESCE). Accepts CSV or Parquet input and emits Parquet output.

  • Kind: standard
  • Network: no

Inputs🔗

NameTypeDescription
tablefile (Parquet, CSV accepted)Source table.
expressionsstringJSON list of {"name": <column>, "expr": <SQL scalar expression>} objects, applied in order, e.g. [{"name":"MB5","expr":"M * B5"},{"name":"value","expr":"DRYBIO_AG * 0.453592 / 1000000.0"},{"name":"B5","expr":"COALESCE(B5, 0)"}]. Write numeric literals in plain decimal form (1000000.0), not scientific notation (1e6), which the SQL expression parser does not accept.

Outputs🔗

NameTypeDescription
resultfile (Parquet)The input table with the new or replaced columns.

Example🔗

- id: 01890000-0000-0000-0000-00000000000d
  name: base.mutate
  inputs:
    - 01890000-0000-0000-0000-000000000000
  args:
    expressions: |
      [
        {"name": "MB5", "expr": "M * B5"},
        {"name": "value", "expr": "DRYBIO_AG * 0.453592 / 1000000.0"},
        {"name": "B5", "expr": "COALESCE(B5, 0)"}
      ]