Transformers
Transformers modify column values before they are compared in queries or emitted in SQL. They use the pipe (|) syntax, applied left-to-right.
Pipe Syntax
Section titled “Pipe Syntax”Apply a transformer to a column with |:
message|upper = "ERROR"
This transforms the value of message using upper before comparing with "ERROR".
Chaining
Section titled “Chaining”Chain multiple transformers with additional pipes:
message|lower|len > 100
Transformers apply left-to-right: lower runs first (string to string), then len (string to int). The result is compared with > 100.
Type System
Section titled “Type System”Each transformer declares an input type and output type. Chained transformers must be type-compatible — the output type of one must match the input type of the next.
| Type | Description |
|---|---|
string | Text values |
int | Integer numbers |
float | Floating-point numbers |
bool | Boolean values |
array | Array of values (use has operator to check membership) |
Built-in Transformers
Section titled “Built-in Transformers”| Transformer | Input | Output | Description |
|---|---|---|---|
upper | string | string | Convert to uppercase |
lower | string | string | Convert to lowercase |
len | string | int | Get string length |
split | string | array | Split by delimiter: split(".") |
SQL Output by Dialect
Section titled “SQL Output by Dialect”Transformers generate dialect-specific SQL function calls. Chained transformers produce nested calls (innermost first):
Single transformer: status|upper = "ERROR"
| Dialect | Generated SQL |
|---|---|
| ClickHouse | equals(upper(status), 'ERROR') |
| PostgreSQL | UPPER(status) = 'ERROR' |
| StarRocks | UPPER(\status`) = ‘ERROR’` |
Chained transformers: message|lower|len > 100
| Dialect | Generated SQL |
|---|---|
| ClickHouse | length(lower(message)) > 100 |
| PostgreSQL | LENGTH(LOWER(message)) > 100 |
| StarRocks | LENGTH(LOWER(\message`)) > 100` |
Split with has: message|split(" ") has "hello"
| Dialect | Generated SQL |
|---|---|
| ClickHouse | has(splitByChar(' ', message), 'hello') |
| PostgreSQL | 'hello' = ANY(STRING_TO_ARRAY(message, ' ')) |
| StarRocks | array_contains(SPLIT(`message`, ' '), 'hello') |
Type Errors
Section titled “Type Errors”If a chain has incompatible types, the editor shows an error:
message|len|upper
This fails because len outputs int, but upper requires string input. The editor displays: “len outputs int, upper requires string input”.
Examples
Section titled “Examples”status|upper = "ERROR"
message|lower|len > 100
host|lower != "localhost"
path|len > 0
tags|split(",") has "urgent"
Transformers vs. Renderers
Section titled “Transformers vs. Renderers”Transformers run before the alias and change the value flyql emits in SQL or matches against. Renderers run after the alias and attach display metadata without ever affecting the generated SQL or the matcher result. If you want to say “return this value uppercased”, use a transformer. If you want to say “render this column as a clickable link in my app”, use a renderer.
| Concern | Transformer | Renderer |
|---|---|---|
| Position in syntax | before alias | after alias |
| Affects generated SQL | yes | no |
| Affects matcher output | yes | no |
| Default registry | 4 built-ins | empty |
See Renderers for the post-alias pipe syntax and Custom Renderers for the registration API.