Named streams are the contract
FROM names an input or an earlier CTE. INTO names an output. These identifiers bind the language to connections supplied by the host; they are not file paths embedded in SQL.
Input recordsJSON
{"ts":"2026-08-23T10:00:00Z","device":{"id":"A-17"},"reading":42.5}
{"ts":"2026-08-23T10:00:01Z","device":{"id":"A-17"},"reading":43.1}Nested field projectionChronusQL
SELECT ts,
device.id AS device_id,
reading
INTO output
FROM input TIMESTAMP BY tsReuse work with WITH
A CTE is a named stream transformation. Later CTEs and output statements can consume it without repeating the definition.
Execution sketchOne input, shared logic, several outputs
FROMInput
WHEREClean CTE
reuseFast CTE
fan-outoutput_all
fan-outoutput_fast
Filter once and fan outChronusQL
WITH Clean AS (
SELECT ts, driver, speed
FROM telemetry
WHERE speed > 0
), Fast AS (
SELECT ts, driver, speed
FROM Clean TIMESTAMP BY ts
WHERE speed > 300
)
SELECT * INTO output_all FROM Clean;
SELECT * INTO output_fast FROM Fast;Script rules
- Declare
WITHdefinitions before final output statements. - Separate final output statements with semicolons.
- A CTE can read a physical input or a previously declared CTE.
- A script may write to multiple named outputs.
- Field names projected by a CTE become the schema visible to downstream statements.