Overview
SQL transforms let you reshape, filter, and enrich row streams between the normalization/ABI decoding stage and the destination. Each transform is a standard SQLSELECT statement scoped to a single output table.
Transforms are optional. When no transform is configured for a table, the full row stream passes through to the destination unchanged.
How It Works
Typed row streams are produced
The normalizer or ABI decoder emits typed row streams for each output table.
SQL transform executes
If a SQL transform is configured for a given table, the query runs against that table’s row stream.
Result replaces the original stream
The query result becomes the new row stream for that table, replacing the original.
Configuration
Define transforms in your pipeline configuration under thetransforms key. Each key must match a normalizer or ABI decoder output table name, and the FROM clause in the query must reference the same table name.
Supported Operations
The following SQL operations are available in transforms:| Operation | Example |
|---|---|
| Column projection | SELECT col1, col2 FROM t |
| Column aliases | SELECT user AS depositor FROM t |
| Filtering | WHERE amount != '0' |
| Logical operators | WHERE a > 0 AND b < 100 |
| IN | WHERE coin IN ('ETH', 'BTC') |
| LIKE | WHERE user LIKE '0xabc%' |
| BETWEEN | WHERE height BETWEEN 100 AND 200 |
| NULL checks | WHERE value IS NOT NULL |
| Type casting | CAST(amount AS DOUBLE) |
| Arithmetic | SELECT gas_used * gas_price AS cost |
| String functions | LOWER(), SUBSTRING(), CONCAT(), TRIM() |
| Conditional | CASE WHEN side = 'buy' THEN 1 ELSE -1 END |
| Null handling | COALESCE(value, '0'), NULLIF(value, '') |
Unsupported Operations
The following operations are rejected at pipeline startup with a validation error:| Operation | Reason |
|---|---|
| JOINs | Requires multiple sources |
| GROUP BY, aggregations | Requires stateful windowing |
| ORDER BY | Unbounded sorting |
| UNION, INTERSECT, EXCEPT | Multi-source set operations |
| Subqueries | Complexity |
| INSERT, UPDATE, DELETE | DML not applicable |
| CREATE, ALTER, DROP | DDL not applicable |
| HAVING, WINDOW, OVER | Windowed aggregations |
| LIMIT, OFFSET | Bounded-only operations |
Validation Rules
Every transform query is validated before the pipeline starts. A query must satisfy all of the following rules:- The query must start with
SELECT. - The query must not contain any unsupported operations.
- The
FROMtable must exist as a known output table from the normalizer or ABI decoder. - The
FROMtable must match the transform key (e.g., a transform keyed ashl_depositsmust selectFROM hl_deposits). - All columns referenced in the
WHEREclause must exist in the table schema.
Examples
Filter zero-value deposits
Remove deposit events where the amount is zero, and project only the columns you need.Rename and project columns
Renameuser to depositor and cast amount from a string to a double-precision number.
Filter by contract address
Keep only swap events emitted by a specific Uniswap V3 router contract.Computed columns with arithmetic
Add a computedtxn_fee_sol column that converts lamports to SOL, and filter out low-volume trades.
Conditional logic for trade direction
Map side codes to human-readable labels, provide a default for nullbuilder_fee, and filter to specific coins.