Skip to content

Transform patterns

Prerequisites · A configured source from Source patterns. Choose the destination load strategy before finalizing transforms when the case uses merge keys, SCD2 columns, partitions, or watermark replacement.
End state · A correct transform block in each dataflow that needs data shaping.

The recipe links below follow execution order. Each topic explains the metadata and gives copyable examples. For source-aware datatype rules, use Datatypes and schema hints.

The Transform block is optional. Most business transformations are configured there. SCD2 and partition columns use destination metadata; system columns are automatic, and column-name sanitization uses a Driver run option. The built-in pipeline runs between read and write.

See the canonical built-in order and responsibilities.

Every selected built-in must be registered and load successfully, including DataMasker when masking configuration is absent. A missing or failed default raises before destination mutation or checkpoint save; unused external plugins do not invalidate the pipeline. Transformers retain their normal no-op behavior when their configuration is absent.

System columns are always added

__created_at, __updated_at, __updated_by, and __dataflow_run_id are added to every driver-managed dataflow output. You do not configure them — just expect them in the destination table.

ColumnValueTransformer

ColumnValueTransformer.

trim: remove surrounding spaces.

case: lowercase or uppercase.

regex_replace: replace every matching substring.

empty_to_null: convert empty strings to null.

fill_null: supply a typed default.

map: translate string codes.

Combine rules in a deliberate order.

SchemaConverter

SchemaConverter.

Cast selected columns in one dataflow.

Reuse global hints or override them locally.

Decimal precision and formatted dates.

Interpret hints from a source datatype system.

Disable one hint or all hint-based casts.

Convert timezone-free timestamps.

HashColumnAdder

HashColumnAdder.

Business-key hashes: SHA-256 or XXHash64.

Choose the hash use case deliberately.

Row hash / hashdiff for change detection.

Use a generated hash for deduplication and merging.

Input types, serialization, and migration.

Deduplicator

Deduplicator.

Composite keys and deterministic tie-breaking.

Fallback behavior you should know.

Keep ties with rank instead of row-number.

ColumnAdder

ColumnAdder.

Constants, replacing a column, and dependent expressions.

RowFilter

RowFilter.

Reference a computed column.

Combine multiple conditions.

Null conditions and skipping the filter.

SCD2ColumnAdder

SCD2ColumnAdder.

SystemColumnAdder

SystemColumnAdder.

PartitionHandler

PartitionHandler.

Existing, derived, and system-column partitions.

DataMasker

DataMasker.

redact: replace non-null values with a constant.

nullify: remove the value.

partial: keep a prefix or suffix.

numeric_bucket: reduce numeric precision.

date_truncate: reduce date or timestamp precision.

Protected columns and missing inputs.

ColumnProjector

ColumnProjector.

Keep and reorder business columns.

Drop unwanted columns.

Rename business columns.

Combine selection/removal with renaming.

ColumnNameSanitizer

ColumnNameSanitizer.

Transform configure flags

The reference collects these flags under dataflows[].transform.configure.

These four settings in transform.configure change built-in behavior:

Key Default Effect
convert_timestamp_ntz false Converts timestamp_ntz columns to timestamp after schema hints when timestamp_timezone is provided
timestamp_timezone unset Timezone used for an explicit NTZ-to-instant conversion
deduplicate_by_rank false Uses rank-based deduplication instead of row-number semantics
missing_column_policy error Controls absent columns in typed value/hash/masking rules and projection; schema hints warn and skip, while dedup remains strict

The class sections above show timestamp and rank cases. Missing-column policy applies across several classes:

Missing-column policy

Use error (the default) when every configured input must exist:

"transform": {
  "value_rules": [{"operation": "trim", "columns": ["name", "legacy_name"]}],
  "configure": {"missing_column_policy": "error"}
}

If legacy_name is absent, this fails. For an optional legacy field, use:

"transform": {
  "value_rules": [{"operation": "trim", "columns": ["name", "legacy_name"]}],
  "configure": {"missing_column_policy": "ignore"}
}

This still trims name and skips the absent legacy_name.

Class What ignore does
ColumnValueTransformer, DataMasker Apply a rule to its existing target columns
HashColumnAdder Skip the whole hash definition if any input is missing; never hash a partial key
ColumnProjector Skip absent select/drop/rename source references
SchemaConverter Independent policy: missing hinted columns warn and skip
Deduplicator Independent policy: missing effective key/order columns fail
ColumnAdder, RowFilter, PartitionHandler This flag does not make SQL expressions tolerate missing inputs

ignore does not bypass datatype validation, protected-column checks, invalid expressions, or name collisions. Keep error when skipping a mask would allow sensitive data through. With no configured operation, each optional class skips its work; framework system-column handling and sanitization still run.


Full example: multi-pattern transform block

This example normalizes an email before masking it, casts the order ID before hashing it, then renames the masked email before writing. It assumes the source includes order_id, email, amount, order_date, and updated_at.

{
  "name":  "orders_to_silver",
  "stage": "bronze2silver",
  "source": {
    "connection_name":   "bronze",
    "schema_name":       "sales",
    "table":             "orders",
    "watermark_columns": ["updated_at"]
  },
  "destination": {
    "connection_name":   "silver",
    "schema_name":       "sales",
    "table":             "orders",
    "load_type":         "merge_upsert",
    "merge_keys":        ["order_id"],
    "partition_columns": [
      { "column": "order_date" }
    ]
  },
  "transform": {
    "value_rules": [
      { "operation": "trim", "columns": ["email"] }
    ],
    "schema_hints": [
      { "column_name": "order_id",   "data_type": "long" },
      { "column_name": "amount",     "data_type": "decimal", "precision": 18, "scale": 2 },
      { "column_name": "order_date", "data_type": "date" },
      { "column_name": "updated_at", "data_type": "timestamp" }
    ],
    "hash_columns": [
      { "target_column": "order_hash", "columns": ["order_id"], "algorithm": "sha256" }
    ],
    "deduplicate_columns": ["order_id"],
    "latest_data_columns": ["updated_at"],
    "additional_columns": [
      { "column": "order_year", "expression": "EXTRACT(YEAR FROM order_date)" }
    ],
    "masking_rules": [
      { "method": "partial", "columns": ["email"], "keep_start": 1, "keep_end": 3 }
    ],
    "rename_columns": {"email": "masked_email"},
    "configure": {
      "convert_timestamp_ntz": false
    }
  }
}

Common mistakes

Symptom Likely cause Fix
Duplicate rows after merge No dedup key or no ordering columns Add deduplicate_columns and latest_data_columns, or let ordering fall back to source.watermark_columns
Wrong types in destination table No schema_hints, or use_schema_hint is disabled on the source connection Add hints and confirm source.connection.use_schema_hint is true
year() function fails on Polars Polars SQL doesn't support year() Use EXTRACT(YEAR FROM col)
date() function fails on Polars Polars SQL doesn't support date(col) Use CAST(col AS DATE)
Partition column missing expression references a column that doesn't exist yet Cast or add the column via schema_hints or additional_columns first
Hash input column missing It is only created by additional_columns, which runs after hashing Hash existing source columns or calculate the value in a later/custom step
Masked field still has its original name Masking changes values, not names Use rename_columns after masking_rules
__updated_at not found in additional_columns System columns are added later in the pipeline Do not reference system columns in additional_columns
Destination columns are unexpectedly lowercase ColumnNameSanitizer runs at the end and defaults to lower Expect lowercase output or run with column_name_mode="snake"

Next

→ Destination & load patterns · Validation checklist