Skip to main content

Nova API — /api/statements

The operations Nova tags public under /api/statements. Generated from reference-src/nova-openapi.json.

GET /api/statements​

Operation id statements_list: in Python client.call("statements_list", …), on the command line stardelt api statements_list.

The statements the caller holds (at most ten), in order of their ids: state, rows read, whether the rows were cut and the seconds since the last request that named each. It answers "which ones do I hold?" when a submit says the caller already holds ten. Only the caller's own are listed. A statement another request is advancing at that moment is listed as RUNNING with rowCount 0.

Responses

CodeDescription
200The caller's statements
401Not signed in

POST /api/statements​

Operation id statements_submit: in Python client.call("statements_submit", …), on the command line stardelt api statements_submit.

Submit one SQL statement as the caller and get a handle to it. The call waits up to waitSeconds (0 to 30, default 5): when the statement ends in that time the answer is 200 and carries the first chunk of rows, otherwise it is 202 and the caller polls statements_get. A statement that fails in the engine is still 200 with state: FAILED and error.

Request body

FieldTypeRequiredDefaultDescriptionConstraints
maxRowsinteger (nullable)NoThe most rows to keep, 1 to 100 000 (the default and the cap). A longer result is cut here, the query is cancelled in the engine and the statement ends SUCCEEDED with truncated: true.min 0
sqlstringYesOne SQL statement, run with the caller's identity.
waitSecondsinteger (nullable)NoHow long the call waits for the statement to end before it answers 202; 0 to 30, default 5.min 0; format int64

Responses

CodeDescription
200The statement ended within the wait
202The statement is still running; poll it
400The statement is empty
401Not signed in
429The caller already holds ten statements; read or cancel one
502The query engine is not reachable

GET /api/statements/{id}​

Operation id statements_get: in Python client.call("statements_get", …), on the command line stardelt api statements_get.

The state of one of the caller's statements. Each call reads the engine's next pages with the caller's current token, for up to waitSeconds (0 to 30, default 0); the rows are read with statements_chunk_get. A statement that nobody polls for the engine's client timeout (5 minutes by default) is cancelled by the engine.

Parameters

NameInTypeRequiredDescription
idpathstringYesThe statement id from statements_submit
waitSecondsqueryintegerNoWait up to this many seconds (0 to 30) for the statement to end

Responses

CodeDescription
200The statement
401The engine refused the caller's token
404No such statement of the caller's
502The query engine is not reachable

DELETE /api/statements/{id}​

Operation id statements_cancel: in Python client.call("statements_cancel", …), on the command line stardelt api statements_cancel.

Cancel one of the caller's statements in the engine and forget it. Idempotent: it answers 204 whether or not the statement exists or is the caller's (it cancels only the caller's own).

Parameters

NameInTypeRequiredDescription
idpathstringYesThe statement id

Responses

CodeDescription
204Cancelled, or nothing to cancel
401Not signed in

GET /api/statements/{id}/chunks/{n}​

Operation id statements_chunk_get: in Python client.call("statements_chunk_get", …), on the command line stardelt api statements_chunk_get.

One chunk (1 000 rows, the last one fewer) of a statement's rows, counted from 0. A chunk exists once it is full or the statement has ended; the call does not wait. With Accept: text/csv the rows come as CSV (RFC 4180, lines end with CRLF) instead of JSON: chunk 0 starts with a row of the column names, the other chunks have none, so the chunks joined in order are one file; null is an empty cell and an array or an object is written as its JSON text.

Parameters

NameInTypeRequiredDescription
idpathstringYesThe statement id
npathintegerYesThe chunk number, from 0

Responses

CodeDescription
200The rows of the chunk
401Not signed in
404No such statement of the caller's, or no such chunk (yet)