CREATE TRANSFORM
Register an experimental continuous query that writes into a keyed target.
Status: Experimental
A transform subscribes to a source query and applies projected changes to an existing keyed target.
CREATE TABLE trade_copy (
id UInt64 NOT NULL,
market String NOT NULL,
amount UInt64 NOT NULL,
PRIMARY KEY (id)
) SETTINGS mode = 'keyed', storage_policy = 'disk_data';
CREATE TRANSFORM copy_trades INTO trade_copy AS
SELECT id, market, amount
FROM trades
SETTINGS start = 'latest';The engine validates that:
- the target already exists and is keyed;
- the projection is compatible with the target schema; and
- the transform produces every target primary-key column.
The v1 body is deliberately narrow: one source relation with a stateless
projection, filter, and scalar arithmetic. It rejects joins, derived tables,
CTEs, UNION, GROUP BY, HAVING, aggregate functions, ORDER BY, LIMIT,
OFFSET, DISTINCT, scalar subqueries, and temporal or HISTORICAL reads.
Materialize or migrate a more complex shape separately instead of assuming the
transform runtime accepts the full one-shot SELECT grammar.
start = 'latest' is the only supported start position and is the default.
On first registration, the engine executes the body once over the source's
currently readable state, sinks that derived result, captures the per-shard
boundary, and then follows later commits. A keyed source is re-derived from its
collapsed latest state, not by replaying every prior version.
start = 'earliest' is rejected. There is no event-by-event historical replay
mode; use a separately validated data migration when the distinction between
current state and every historical event matters.
Lifecycle
SHOW TRANSFORMS;
SHOW CREATE TRANSFORM copy_trades;
ALTER TRANSFORM copy_trades PAUSE;
ALTER TRANSFORM copy_trades RESUME;
DROP TRANSFORM copy_trades;Dropping a transform leaves its target table intact. Pausing and resuming are control-plane operations for the in-process runtime.
Transforms currently run in the single all-in-one process. There is no cross-node checkpoint, automatic failover, or resumable distributed worker contract. Validate restart behavior and target correctness for the exact release before using a transform in a critical path.