Using Snowflake SQL API for running queries on small databases
- How-Tos FAQs
- August 11, 2021

Let’s look at using Snowflake SQL API for running queries on small databases. If you’re looking for a backend for your high-demand API, you can’t go wrong with Snowflake. It’s fast, scalable, and reliable, making it perfect for handling large amounts of data. Its built-in features make connecting to other systems and data sources easy. Snowflake SQL API is the perfect solution when you need to run minuscule queries behind a high-demand API on a small table.
Snowflake provides a SQL API, which is a REST API that makes it easy to query data stored in your Snowflake account. To get started, you’ll need to generate a security token that will be used to authenticate your requests. Once you have a token, you can begin making requests to the API. The Snowflake Rest API supports various queries, including select, insert, update, and delete. You can also use the API to run stored procedures and functions.
In this blog, we will introduce you to the basics of the Snowflake REST API. We will cover how to make requests to the API, how to pass parameters to your requests, and how to handle the responses from the API.
But first… Datameer
Datameer can complete all the data transformation we’ve done above without SQL. Each transformation we’ve done can be created as a no-code recipe or a series of operations.
One nice thing about Datameer is that the transformation steps are laid out graphically, so it’s not necessary to know SQL to walk through the transformation recipe with any of a project’s stakeholders.
Datameer also makes maintenance easier. You don’t have to sift through a lot of code if you want to add a transformation to the recipe or modify an existing transformation.
Try Datameer’s free 14 day trial today!
Features of Snowflake REST API
The following are some key features of the Snowflake SQL API:
- The API is based on REST principles, making it easy to use from any programming language or platform.
- Snowflake SQL API is well-documented, with code samples in multiple languages.
- It uses standard HTTP verbs (GET, POST, PUT, DELETE) for issuing commands and retrieving results.
- You can use the API to manage your snowflake account, including creating and deleting databases and tables and adding and deleting users.
- It’s implemented as a set of HTTP endpoints you can access using any standard HTTP client. The endpoints provide access to the Snowflake database’s features, including creating and managing tables, loading data, running queries, and so on.
- The API is organized into a set of resources , each corresponding to a different aspect of the Snowflake database. For example, the /tables resource provides access to all the tables in your database, while the /query resource enables you to run queries.
- Each API endpoint includes a set of parameters that you can use to control the operation. For example, the /query endpoint includes parameters to specify the query to run, the output format, and other options.
Operations under SQL API
The Snowflake SQL API provides the following operations that can be used:
- Check the status of the execution of a statement.
- Submit SQL statements for execution.
- Fetch query results concurrently.
- Cancel the execution of a statement.
Limitations of the SQL API
The following commands are not supported by SQL API :
- 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).
How to authenticate with OAuth
1. Set up OAuth and get an OAuth token.
2. Use SnowSQL to verify that you can use the OAuth token received to connect to Snowflake:
For Windows systems
$ snowsql -a <account_identifier> -u <user>
--authenticator=oauth --token="<oauth_token>"
3. Set the following headers for each API request that you send in your application code:
Authorization: Bearer oauth_token
X-Snowflake-Authorization-Token-Type: OAUTH
Snowflake-Account: account_locator
Conclusion
The best part about the SQL Rest API is that it is easy to use and easy to get started with. So if you’re looking for a way to access your Snowflake data through a REST API, give using Snowflake SQL API for running queries on small databases a try!