Execute SQL statement
POST
/api/v1/statements/execute
const url = 'https://example.com/api/v1/statements/execute';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"statement":"example","warehouse_id":"example","catalog":"example","schema":"example","wait":true,"poll_interval":1.5,"max_wait_seconds":600}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/statements/execute \ --header 'Content-Type: application/json' \ --data '{ "statement": "example", "warehouse_id": "example", "catalog": "example", "schema": "example", "wait": true, "poll_interval": 1.5, "max_wait_seconds": 600 }'Execute a SQL statement.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
StatementExecuteRequest
Legacy request model for backwards compatibility.
object
statement
required
Statement
SQL statement to execute
string
warehouse_id
required
Warehouse Id
SQL warehouse ID to use for execution
string
wait
Wait
Wait for statement completion
boolean
poll_interval
Poll Interval
Polling interval in seconds
number
max_wait_seconds
Max Wait Seconds
Maximum wait time in seconds
integer
Responses
Section titled “Responses”Successful Response
Media typeapplication/json
StatementExecuteResponse
Legacy response model for backwards compatibility.
object
status
required
Status
Execution status (SUBMITTED, SUCCEEDED, FAILED, CANCELED)
string
statement_id
required
Statement Id
Unique identifier for the statement
string
columns
Any of:
Array<string>
null
rows
Any of:
Array<Array>
null
Examplegenerated
{ "status": "example", "statement_id": "example", "columns": [ "example" ], "rows": [ [ "example" ] ], "error": "example", "execution_time_seconds": 1}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}