Queries

Execute SQL

Runs SQL against a connection and returns rows plus column metadata. Read-only guarded: only SELECT, WITH (CTE) and EXPLAIN are accepted, one statement at a time; write/DDL/admin verbs (INSERT, UPDATE, DELETE, DROP, …) are rejected with 403, and invalid SQL with 400. limit defaults to 1000, caps at 10000. Available to API keys with the execute scope. Exceeding the monthly query quota or the rate limit returns 429.

post/queries/execute

Request

  • Base URL: https://saturnsql.com/api
  • URL: https://saturnsql.com/api/queries/execute
  • Auth: one of:
    • HTTP bearer
    • HTTP bearer

Query parameters

connectionIdstring required

Database connection ID

sqlstring required

Read-only SQL query to execute (SELECT / WITH / EXPLAIN). May contain {{variable}} placeholders, in which case variables must define every one of them.

limitnumber required

Maximum rows to return (default: 1000, max: 10000)

variablesobject required

Definitions for the {{placeholders}} in sql. Values are type-checked and escaped against these server side.

valuesobject required

Variable values by name. An absent name falls back to that variable's default; a name present with an empty string stays empty.

timeZonestring required

IANA time zone used to resolve relative date defaults (default: UTC)

Request body

connectionIdstring required
sqlstring required

Read-only SQL: SELECT / WITH / EXPLAIN

limitinteger

Max rows (default 1000)

Response

Result rows

successboolean

Changes

No recorded changes to this operation across all 1 revision of this API.