Skip to main content
POST
Query (routed)

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Provide either query or script, never both.

query
string

The SQL to run.

Example:

"SELECT species, count(*) AS n FROM oleander.default.flowers GROUP BY 1"

script
string

A Polars DataFrame script that assigns result. Mutually exclusive with query; forces the Polars engine.

Example:

"result = events.group_by('day').len()"

tables
(string | object)[]

Tables a script reads, as "alias=namespace.table" or {alias, table}. Script mode only.

engine
enum<string>
default:auto

Ask for a specific engine. An impossible combination returns an engine capability error rather than rerouting.

Available options:
auto,
duckdb,
polars,
bloom,
spark
destination
string

Table to write the result to, as a dotted identifier such as namespace.table. Presence of a destination makes this a write.

Example:

"default.daily_counts"

write_mode
enum<string>
default:overwrite

Applies to a destination write. A statement that names its own target carries its own semantics.

Available options:
overwrite,
append
explain
boolean
default:false

Return the routing decision without executing anything or spending compute.

Response

Query executed, submitted, or explained.

success
boolean
Example:

true

explain
boolean

Present and true when explain was requested. No compute was spent and no other result fields are returned.

engine_decision
object

How the query router chose the engine and machine for this run.

results
object | null

Rows, for interactive reads only. Absent on submitted runs.

row_count
integer | null
execution_time
string | null
Example:

"42ms"

state
enum<string>

COMPLETE means the write already landed. SUBMITTED means a job is running and run_id must be polled.

Available options:
COMPLETE,
SUBMITTED
run_id
string | null

Run to poll when state is SUBMITTED.

output_table
string | null

Fully qualified destination table for a write.

compute
object | null

The sandbox or cluster that actually served the run. A warm larger sandbox can serve a smaller request, and that is the machine the org is billed for.

job
object

Lineage job identity for this query.