Solidafy DSL
DSL overview
The Solidafy DSL is the language you use to read, reshape and write data in Solidafy. This page explains how a query is put together and where you run it, so you can read the rest of the DSL reference without guessing.
What it looks like
A query starts with a source, chains transforms onto it with ., and can end with one terminal that writes or renders the result:
source("github.pull_requests")
.filter(state == "merged")
.since(merged_at, "30d")
.group_by([repo])
.agg([count() as merged_prs, avg(additions + deletions) as avg_size])
.sort([merged_prs: desc])
.limit(10)
It is not SQL. There is no SELECT, FROM or WHERE; each step takes the rows from the step before it and hands its result to the next. If you know SQL, the mapping is direct: .filter() is WHERE, .group_by() plus .agg() is GROUP BY, .sort() is ORDER BY, and so on.
Table names are always namespace.table. A namespace groups related tables, for example everything synced from one connector.
Where you use it
The same language runs everywhere in Solidafy:
- The CLI.
solidafy dslruns a query against your active environment. See CLI commands. - Pipelines. Each transform step in a pipeline is a DSL query that ends in
.output()and writes a table. See Pipelines. - Dashboards. Every chart is a DSL query that ends in
.chart(). See Dashboards. - Scout. When you ask Scout a question, it writes and runs a read-only DSL query for you. See Scout.
Running queries from the CLI
# Read: print the result as a table
solidafy dsl 'source("github.pull_requests").limit(5)'
# Read: one JSON document on stdout with every row, for scripts
solidafy dsl --json 'source("github.pull_requests").count()'
# Write: anything that ends in .output() runs as a job
solidafy dsl -x 'source("raw.deployments").dedupe([id], keep: latest_by(_extracted_at)).output("bronze.deployments", mode: replace)'
Plain solidafy dsl is for reading. The table view shows the first 100 rows and cuts long cells at 40 characters; use --json when you need everything. -x (--execute) submits the query as a temporary job and waits for it to finish, so it is not interactive. Writing to an environment named production or prod also needs --force.
Tip: To see a table's columns and types without pulling rows, append
.schema():source("github.pull_requests").schema().
Sources
Every query starts with one source.
| Source | What it reads |
|---|---|
source("ns.table") | A table in your environment's catalog |
name | A variable you defined earlier in the same query (see Variables) |
union([a, b, ...]) | Several sources stacked into one |
sql("SELECT ...") | The result of a SQL query, which you can then keep transforming |
mock([{...}, {...}]) | Inline rows, handy for trying a transform without touching real data |
connector("name", ...).stream("s") | Rows pulled straight from a connector; see Connectors |
Table source options
source("github.pull_requests", time: merged_at, granularity: 1d)
source("cloud.costs", partition: usage_date >= "2026-09-01")
source("enrich.team_overrides", optional: true)
source("github.pull_requests", as: "pr")
| Option | Meaning |
|---|---|
time: col | Marks col as the table's time column. Enables @time and @granularity (see Runtime variables). |
granularity: 1h | Bucket size for @granularity. Units: s, m (minutes), h, d, w, mo. |
partition: col op value | A filter applied while reading files, so less data is scanned. Operators: ==, !=, >, >=, <, <=, in, not in, between. Combine several with AND. |
optional: true | If the table does not exist yet, read it as empty instead of failing. |
as: "alias" | A name for the source, so you can write alias.column after a join. |
audit: "ns.table" | Incremental processing with a watermark; see Incremental reads. |
catalog_url: "...", api_key: "..." | Reads the table from another environment's catalog; see Reading from another environment. |
When you set time:, .select() keeps the time column even if you leave it out of the list, and .drop() leaves it in place, because @granularity and chart sparklines depend on it.
Reading from another environment
catalog_url: and api_key: point one source at a different environment's catalog, for example to build a staging table from production data. catalog_url is that environment's catalog address and api_key an API key for that environment.
source("bronze.deployments", catalog_url: "https://...", api_key: "sk_live_...")
.output("bronze.deployments", mode: replace)
- Give both options together, or the query is rejected. They work only on a
source("namespace.table"), not on a variable. - The rows are copied into memory before the rest of the query runs. A read larger than 1 GiB fails, so narrow it with a
partition:filter. - A
${NAME}placeholder in either value is filled in only from the variables the running job itself was given. Any other name is left as the literal text${NAME}, so the read fails to authenticate rather than picking up a value from somewhere else.
.output() takes the same two options to write into another environment; see Options.
union
union([
source("gitlab.merge_requests").select([id, author, merged_at]),
source("github.pull_requests").select([id, author, merged_at])
], distinct: true)
Members are stacked by column position, so give every member the same columns in the same order. Each member can carry its own transforms. distinct: true removes duplicate rows after stacking.
mock
mock([
{service: "api", deployed_at: "2026-09-28T10:00:00Z", status: "success"},
{service: "api", deployed_at: "2026-09-29T15:30:00Z", status: "failed"}
]).filter(status == "failed")
mock() takes a list of JSON-style objects. It also accepts time: and granularity:.
Chaining and terminals
A chain is source, then any number of transforms, then at most one terminal:
| Terminal | What it does | Reference |
|---|---|---|
.output("ns.table", ...) | Writes the result to a table | Writing tables |
.rollup("ns.table", ...) | Writes hourly, daily, monthly or yearly aggregate tables | Time rollups |
.train(...) | Fits a prediction model on the rows and stores it | Machine learning |
.chart(type, ...) | Turns the result into a chart | Dashboards |
.push("connector", ...) | Sends each row to an external system, for example as a Slack message | Alerts |
.trace_tree(...) | Shows OpenTelemetry span rows as a nested trace tree in the portal's query results and dashboards | See below |
.trace_tree() expects span rows with trace_id, span_id and parent_span_id columns; name different span columns with span_id: "col" and parent_span_id: "col". With expand: true it also fetches every other span of the traces your filter matched, so a filter that hits one span still shows its whole trace:
source("otel.spans")
.filter(trace_id == "4bf92f3577b34da6a3ce929d0e0e4736")
.trace_tree(expand: true)
A chain without a terminal just returns rows. The full list of transforms is in Transforms, and the functions you can use inside them are in Functions.
Variables
Assign a chain to a name and reuse it later in the same query. The last statement must be a bare chain: it is the one that runs, and assignments only produce data for it.
merged = source("github.pull_requests").filter(state == "merged")
devs = source("enrich.developers").select([github_handle, team])
merged
.join(devs, left_on: [author], right_on: [github_handle], type: left)
.group_by([team])
.agg([count() as merged_prs])
Each variable is computed once and then read like a table, so a filter written after it never leaks back into its definition.
Scalar variables
A name that starts with @ holds a number instead of rows. Set it to a literal or to a query that returns one row:
@budget = 5000
@stats = source("cloud.costs").since(usage_date, "30d").agg([sum(cost) as total, avg(cost) as daily_avg])
source("cloud.costs")
.since(usage_date, "30d")
.group_by([service])
.agg([sum(cost) as service_cost])
.add([service_cost / @stats.total * 100.0 as pct_of_total])
.filter(service_cost > @budget)
If the query returns one column, use @name. If it returns several, use @name.column. The values are read as numbers.
Runtime variables
These names are filled in when the query runs:
| Variable | Value |
|---|---|
@time | The column named in time: on the source |
@granularity | The time column bucketed by granularity: and formatted as text, for example 2026-09-30 for 1d or 2026-09 for 1mo |
@today, @date | Today's date as YYYY-MM-DD (UTC) |
@yesterday | Yesterday's date as YYYY-MM-DD (UTC) |
@now | The current timestamp |
@watermark | The last processed _extracted_at, when the source has audit: |
source("github.pull_requests", time: merged_at, granularity: 1w)
.since(@time, "90d")
.group_by([@granularity])
.agg([count() as merged_prs])
.sort([granularity: asc])
After .group_by([@granularity]) the result has a plain column called granularity, so later steps refer to it without the @.
Dashboards add one more kind of placeholder, [%name%], which is replaced by the value of a dashboard filter before the query runs. It only works in chart queries. See Dashboard filters.
Syntax basics
- Strings use double quotes only:
"merged". Backslashes are not processed, so a regex like"^v[0-9]+\.[0-9]+"reaches the regex engine exactly as written. - Comments are
// to the end of the lineor/* block */.#is not a comment. - Lists use square brackets:
.select([repo, author]),status in ["open", "draft"]. - Options are
name: valuepairs:.sort([merged_at: desc]),.output("ns.t", mode: replace). - Nested fields use dots:
author.login. The result column is named with underscores,author_login, unless you give it an alias. - Null checks use
is nullandis not null.col == nullis never true.
Reading and writing
A query writes only when it ends in .output(), .rollup() or .train(), or uses a maintenance command such as compact() (see Table maintenance). Everything else is a read. Charts, Scout and plain solidafy dsl are read paths; Scout refuses to run a query that contains .output().
Meta directives
The grammar accepts directives such as @job, @schedule, @depends_on, @parallelism, @env and @alert at the top of a DSL file. They do not schedule or configure anything when Solidafy runs your query. Schedules, dependencies and alerting are set on the pipeline instead: see Triggers and webhooks and Alerts.
