Overview
SQL transforms let you process streaming data with SQL. They run on Apache DataFusion, so the dialect is standard DataFusion SQL — with Turbo-specific extensions for blockchain data. See the SQL Functions Reference for the full list of built-in functions.Streaming SQL Limitations: Joins, aggregations, and window functions are
not supported in streaming mode. Each transform must read from a single base
table. Use dynamic tables for
lookup-style joins and chain SQL transforms for multi-step logic.
Basic Configuration
Parameters
string
required
Must be
sqlstring
required
The column that uniquely identifies each row (e.g.,
id, transaction_hash,
log_index)string
required
The SQL query to execute. Reference sources or upstream transforms by name
directly in the
FROM clause — there is no separate from: field for SQL
transforms.Supported SQL Features
SELECT and Projections
Select specific columns from your data:WHERE Clauses (Filtering)
Filter rows based on conditions:Column Transformations
Transform column values using functions:CAST and Type Conversions
Convert between data types:String Functions
Common string operations:Date and Time Functions
Work with timestamps:Array Functions
Process array columns:Conditional Logic (CASE)
Use CASE statements for conditional transformations:Adding Literal Columns
Add constant values or labels:Custom SQL Functions
Turbo pipelines includes 100+ custom SQL functions for blockchain data processing:- EVM Functions - Decode logs with
evm_log_decode(), hash with_gs_keccak256() - Solana Functions - Decode instructions, analyze transactions, track balances
- Large Number Arithmetic - U256/I256 functions for precise token calculations
- Array Processing -
array_filter(),array_enumerate(),zip_arrays() - JSON Functions - Query and construct JSON with
json_query(),json_object() - Encoding - Hex, Base58, and binary conversions
U256/I256 types support standard operators (
+, -, *, /, %) which are
automatically rewritten by the SQL preprocessor to their function equivalents.Dynamic Table Integration
Usedynamic_table_check() to filter based on values in a dynamic table:
Limitations
Best Practices
1. Select only needed columns
1. Select only needed columns
Only select the columns you need to reduce data transfer and memory usage:
2. Filter early
2. Filter early
Apply filters as early as possible in your pipeline. Chain SQL transforms by
referencing upstream transform names in the
FROM clause:3. Use appropriate data types
3. Use appropriate data types
Cast to the correct types for your use case:
4. _gs_op is auto-propagated
4. _gs_op is auto-propagated
_gs_op (the change-data-capture operation column used by upsert-aware
sinks) is automatically carried through SQL transforms — you do not need
to select it explicitly. You can still include it if you want to project
or reorder it:5. Use descriptive column aliases
5. Use descriptive column aliases
Make your transformed data self-documenting: