Introduction to the SQL API

The Snowflake SQL API is a REST API that you can use to access and update data in a Snowflake database. You can use this API to develop custom applications and integrations that:

  • Perform queries.

  • Manage your deployment (e.g. provision users and roles, create tables, etc.).

In this Topic:

Capabilities of the SQL API

The Snowflake SQL API provides operations that you can use to:

  • Submit SQL statements for execution.

  • Check the status of the execution of a statement.

  • Cancel the execution of a statement.

  • Fetch query results concurrently.

You can use this API to execute standard queries and most DDL and DML statements. See Limitations of the SQL API for the types of statements that are not supported.

For queries, the SQL API returns data in partitions. Snowflake determines the number of partitions returned and the size of each partition.

The endpoint for the SQL API (/api/v2/statements) is protected by the network policies that restrict access to the account where the API is enabled.

Note

The AUTOCOMMIT parameter must be set to TRUE for the user or account you have given permission to access the SQL API. You cannot set AUTOCOMMIT at the session level using the SQL API.

Limitations of the SQL API

The SQL API has the following limitations:

  • The following commands are not supported:

    • The PUT command (in Snowflake SQL)

    • The GET command (in Snowflake SQL)

    • The CALL command with stored procedures that return a table (stored procedures with the RETURNS TABLE clause).

The following commands and statements are supported only within a request that specifies multiple statements:

  • Commands that perform explicit transactions, including:

  • Commands that change the context of the session, including:

  • Statements that set session variables.

  • Statements that create temporary tables and stages (tables and stages that are available only in the current session).

Billing Considerations When Using the SQL API

The SQL API leverages the cloud services layer when fetching some query results. For more information about cloud services, see Cloud Services Credit Usage.

Back to top