Submits a SQL statement for execution.
POST {{baseUrl}}/api/v2/statements?requestId=<uuid>&async=<boolean>&nullable=<boolean>
Submits a single statement for execution. You can specify that the statement should be executed asynchronously.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
requestId | string | Unique ID of the API request. This ensures that the execution is idempotent. If not specified, a new UUID is generated and assigned. | |
async | string | Set to true to execute the statement asynchronously and return the statement handle. If the parameter is not specified or is set to false, a statement is executed and the first result is returned if the execution is completed in 45 seconds. If the statement execution takes longer to complete, the statement handle is returned. | |
nullable | string | Set to true to execute the statement to generate the result set including null. If the parameter is set to false, the result set value null will be replaced with a string 'null'. |
Request Body
{"statement"=>"<string>", "timeout"=>"<long>", "database"=>"<string>", "schema"=>"<string>", "warehouse"=>"<string>", "role"=>"<string>", "parameters"=>{"timezone"=>"<string>", "query_tag"=>"<string>", "binary_output_format"=>"<string>", "date_output_format"=>"<string>", "time_output_format"=>"<string>", "timestamp_output_format"=>"<string>", "timestamp_ltz_output_format"=>"<string>", "timestamp_ntz_output_format"=>"<string>", "timestamp_tz_output_format"=>"<string>", "multi_statement_count"=>1}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
User-Agent | string | (Required) Set this to the name and version of your application (e.g. “applicationName/applicationVersion”). You must use a value that complies with RFC 7231. | |
X-Snowflake-Authorization-Token-Type | string | Specify the authorization token type for the Authorization header. KEYPAIR_JWT is for Keypair JWT or OAUTH for oAuth token. If not specified, OAUTH is assumed. | |
Content-Type | string | ||
Accept | string |
RESPONSES
status: OK
{"code":"\u003cstring\u003e","sqlState":"\u003cstring\u003e","message":"\u003cstring\u003e","statementHandle":"\u003cuuid\u003e","createdOn":"\u003clong\u003e","statementStatusUrl":"\u003curi\u003e","resultSetMetaData":{"format":"\u003cstring\u003e","rowType":[{"name":"\u003cstring\u003e","type":"\u003cstring\u003e","length":"\u003clong\u003e","precision":"\u003clong\u003e","scale":"\u003clong\u003e","nullable":"\u003cboolean\u003e"}],"partitionInfo":[{"rowCount":"\u003clong\u003e","compressedSize":"\u003clong\u003e","uncompressedSize":"\u003clong\u003e"},{"rowCount":"\u003clong\u003e","compressedSize":"\u003clong\u003e","uncompressedSize":"\u003clong\u003e"}],"nullable":"\u003cboolean\u003e","parameters":{"binary_output_format":"\u003cstring\u003e","date_output_format":"\u003cstring\u003e","time_output_format":"\u003cstring\u003e","timestamp_output_format":"\u003cstring\u003e","timestamp_ltz_output_format":"\u003cstring\u003e","timestamp_ntz_output_format":"\u003cstring\u003e","timestamp_tz_output_format":"\u003cstring\u003e","multi_statement_count":"\u003cinteger\u003e"}},"data":[["\u003cstring\u003e","\u003cstring\u003e"],["\u003cstring\u003e","\u003cstring\u003e"]],"stats":{"numRowsInserted":"\u003clong\u003e","numRowsUpdated":"\u003clong\u003e","numRowsDeleted":"\u003clong\u003e","numDuplicateRowsUpdated":"\u003clong\u003e"}}