v3

latestOpenAPI 3.0.0raw.githubusercontent.com2026-04-023429.2 KB
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

statementstring

SQL statement or batch of SQL statements to execute. You can specify query, DML and DDL statements. The following statements are not supported: PUT, GET, USE, ALTER SESSION, BEGIN, COMMIT, ROLLBACK, statements that set session variables, and statements that create temporary tables and stages.

timeoutinteger

Timeout in seconds for statement execution. If the execution of a statement takes longer than the specified timeout, the execution is automatically canceled. To set the timeout to the maximum value (604800 seconds), set timeout to 0.

databasestring

Database in which the statement should be executed. The value in this field is case-sensitive.

schemastring

Schema in which the statement should be executed. The value in this field is case-sensitive.

warehousestring

Warehouse to use when executing the statement. The value in this field is case-sensitive.

rolestring

Role to use when executing the statement. The value in this field is case-sensitive.

bindingsobject

Values of bind variables in the SQL statement. When executing the statement, Snowflake replaces placeholders ('?' and ':name') in the statement with these specified values.

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.

codestring
sqlStatestring
messagestring
statementHandlestring uuid
createdOninteger

Timestamp that specifies when the statement execution started.‌ The timestamp is expressed in milliseconds since the epoch.‌

statementStatusUrlstring uri

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
  }
}