surfacecleaningnormalize_unit
Cleaningscalar · returns varchar

NORMALIZE_UNIT

Convert a value to a target unit via pint

Per-row — runs once for each row.

cleaningllmtext

Syntax

NORMALIZE_UNIT({{ value }}, '{{ target_unit }}')

Arguments

nametypedescription
valueVARCHAR
target_unitVARCHARTarget unit: kg, lb, m, ft, cm, ml, l, oz, celsius, etc.

About

Convert a value with units to a target unit, returning the converted value as a formatted string. Backend: deterministic Python via `pint`. Handles mass, length, volume, temperature, time, pressure, area, and everything else pint knows about (hundreds of units). Case-insensitive unit names and common aliases ("lb" / "pound" / "lbs", "kg" / "kilogram"). For LLM-style conversion with fuzzy unit matching, use NORMALIZE_UNIT_LLM — see normalize_unit_single_llm.cascade.yaml.

Examples

5 kg approx 11.02 lb

SELECT
  normalize_unit ('5 kg', 'lb')

100F approx 37.78 C

SELECT
  normalize_unit ('100 F', 'celsius')

Nearby rabbit holes

same domain
Climb back to The Looking Glass