statements
Submits a SQL statement for execution.
Submits one or more statements for execution. You can specify that the statement should be executed asynchronously.
post/api/v2/statements
Request body
Example request
{
"timeout": 10,
"database": "TESTDB",
"schema": "TESTSCHEMA",
"warehouse": "TESTWH",
"role": "TESTROLE",
"bindings": {
"1": {
"type": "FIXED",
"value": "123"
},
"2": {
"type": "TEXT",
"value": "teststring"
}
},
"parameters": {
"timezone": "america/los_angeles",
"query_tag": "tag-1234",
"binary_output_format": "HEX",
"date_output_format": "YYYY-MM-DD",
"time_output_format": "HH24:MI:SS.FF6",
"timestamp_output_format": "YYYY-MM-DDTHH24:MI:SS.FF6",
"timestamp_ltz_output_format": "YYYY-MM-DDTHH24:MI:SS.FF6",
"timestamp_ntz_output_format": "YYYY-MM-DDTHH24:MI:SS.FF6",
"timestamp_tz_output_format": "YYYY-MM-DDTHH24:MI:SS.FF6 TZHTZM",
"multi_statement_count": 4
}
}Response
The statement was executed successfully, and the response includes any data requested.
Example response
{
"code": "000123",
"sqlState": "42601",
"message": "successfully executed",
"statementHandle": "536fad38-b564-4dc5-9892-a4543504df6c",
"createdOn": 1597090533987,
"resultSetMetaData": {
"format": "jsonv2",
"numRows": 100,
"rowType": [
{
"name": "ROWNUM",
"type": "FIXED",
"length": 0,
"precision": 38,
"scale": 0,
"nullable": false
},
{
"name": "ACCOUNT_ID",
"type": "FIXED",
"length": 0,
"precision": 38,
"scale": 0,
"nullable": false
},
{
"name": "ACCOUNT_NAME",
"type": "TEXT",
"length": 1024,
"precision": 0,
"scale": 0,
"nullable": false
},
{
"name": "ADDRESS",
"type": "TEXT",
"length": 16777216,
"precision": 0,
"scale": 0,
"nullable": true
},
{
"name": "ZIP",
"type": "TEXT",
"length": 100,
"precision": 0,
"scale": 0,
"nullable": true
},
{
"name": "CREATED_ON",
"type": "TIMESTAMP_NTZ",
"length": 0,
"precision": 0,
"scale": 3,
"nullable": false
}
],
"partitionInfo": [
{
"rowCount": 1324,
"compressedSize": 37436824,
"uncompressedSize": 1343787384
}
],
"parameters": {
"binary_output_format": "HEX",
"date_output_format": "YYYY-MM-DD",
"time_output_format": "HH24:MI:SS",
"timestamp_output_format": "YYYY-MM-DD HH24:MI:SS.FF6",
"timestamp_ltz_output_format": "YYYY-MM-DD HH24:MI:SS.FF6",
"timestamp_ntz_output_format": "YYYY-MM-DD HH24:MI:SS.FF6",
"timestamp_tz_output_format": "YYYY-MM-DDTHH24:MI:SS.FF6 TZHTZM",
"multi_statement_count": 4
}
},
"data": [
[
"customer1",
"1234 A Avenue",
"98765",
"2019-08-10 23:56:34.123"
],
[
"customer2",
"987 B Street",
"98765",
"2019-08-11 09:45:12.890"
],
[
"customer3",
"8777 C Blvd",
"98765",
"2019-08-12 10:23:51.999"
],
[
"customer4",
"64646 D Circle",
"98765",
"2019-08-13 01:54:32.000"
]
],
"stats": {
"numRowsInserted": 12,
"numRowsUpdated": 9,
"numRowsDeleted": 8,
"numDuplicateRowsUpdated": 20
}
}