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

KeyDatatypeRequiredDescription
requestIdstringUnique ID of the API request. This ensures that the execution is idempotent. If not specified, a new UUID is generated and assigned.
asyncstringSet 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.
nullablestringSet 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

KeyDatatypeRequiredDescription
User-Agentstring(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-TypestringSpecify 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-Typestring
Acceptstring

RESPONSES

status: OK

{&quot;code&quot;:&quot;\u003cstring\u003e&quot;,&quot;sqlState&quot;:&quot;\u003cstring\u003e&quot;,&quot;message&quot;:&quot;\u003cstring\u003e&quot;,&quot;statementHandle&quot;:&quot;\u003cuuid\u003e&quot;,&quot;createdOn&quot;:&quot;\u003clong\u003e&quot;,&quot;statementStatusUrl&quot;:&quot;\u003curi\u003e&quot;,&quot;resultSetMetaData&quot;:{&quot;format&quot;:&quot;\u003cstring\u003e&quot;,&quot;rowType&quot;:[{&quot;name&quot;:&quot;\u003cstring\u003e&quot;,&quot;type&quot;:&quot;\u003cstring\u003e&quot;,&quot;length&quot;:&quot;\u003clong\u003e&quot;,&quot;precision&quot;:&quot;\u003clong\u003e&quot;,&quot;scale&quot;:&quot;\u003clong\u003e&quot;,&quot;nullable&quot;:&quot;\u003cboolean\u003e&quot;}],&quot;partitionInfo&quot;:[{&quot;rowCount&quot;:&quot;\u003clong\u003e&quot;,&quot;compressedSize&quot;:&quot;\u003clong\u003e&quot;,&quot;uncompressedSize&quot;:&quot;\u003clong\u003e&quot;},{&quot;rowCount&quot;:&quot;\u003clong\u003e&quot;,&quot;compressedSize&quot;:&quot;\u003clong\u003e&quot;,&quot;uncompressedSize&quot;:&quot;\u003clong\u003e&quot;}],&quot;nullable&quot;:&quot;\u003cboolean\u003e&quot;,&quot;parameters&quot;:{&quot;binary_output_format&quot;:&quot;\u003cstring\u003e&quot;,&quot;date_output_format&quot;:&quot;\u003cstring\u003e&quot;,&quot;time_output_format&quot;:&quot;\u003cstring\u003e&quot;,&quot;timestamp_output_format&quot;:&quot;\u003cstring\u003e&quot;,&quot;timestamp_ltz_output_format&quot;:&quot;\u003cstring\u003e&quot;,&quot;timestamp_ntz_output_format&quot;:&quot;\u003cstring\u003e&quot;,&quot;timestamp_tz_output_format&quot;:&quot;\u003cstring\u003e&quot;,&quot;multi_statement_count&quot;:&quot;\u003cinteger\u003e&quot;}},&quot;data&quot;:[[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;],[&quot;\u003cstring\u003e&quot;,&quot;\u003cstring\u003e&quot;]],&quot;stats&quot;:{&quot;numRowsInserted&quot;:&quot;\u003clong\u003e&quot;,&quot;numRowsUpdated&quot;:&quot;\u003clong\u003e&quot;,&quot;numRowsDeleted&quot;:&quot;\u003clong\u003e&quot;,&quot;numDuplicateRowsUpdated&quot;:&quot;\u003clong\u003e&quot;}}