In this quick guide, we’ll walk through the essential steps to connect to Snowflake using SnowSQL, Snowflake’s powerful command-line interface. You’ll learn how to set up SnowSQL, configure your connection settings, and authenticate securely to your Snowflake account. Whether you’re new to Snowflake or just getting started with SnowSQL, this tutorial will provide a solid foundation to help you query and manage data in Snowflake directly from your terminal.
Read more: Getting Started with SnowSQL: Connecting to Your Snowflake AccountContents
What is SnowSQL?
We can define it as the command line client connects to Snowflake to execute SQL queries and perform all DDL and DML operations, including loading data into and unloading data out of database tables.
How to install SnowSQL?
The process of installing SnowSQL is simple, you have to go to the Snowflake link for downloading.
You should choose the version which is required for you. In my case, I have the Windows version.
Once you have downloaded the SnowSQL installer, you should follow the next steps as the following images show
Preparing the credentials and accessing SnowSQL
If you are using Windows, you could use Powershell and Command Prompt . In my case, I will open Command Prompt and prepare the snowsql command.
1 |
snowsql -a account_name -u User -r SYSADMIN -w COMPUTE_WH |
You can get the account name from your Snowflake UI, go to your account and copy account URL, once copied, you should remove the https:// and the text .snowflakecomputing.com . The User is who has been defined by you.
At this point, you will receive a Password prompt. Once you enter it, you should be able to access the main or default DB associated with your User.
So, here, you can interact with Snowflake, in my example I does a simple query, for instance:
SHOW TABLES;
Note: If you are working interactively into Windows CMD, you can set the password variable into your session and SnowSQL will automatically read it. To initialize the password you can simply write in command line the code:
1 |
set SNOWSQL_PWD=YourPasswordHere |
Conclusion
In this guide, we covered the basic steps to connect to Snowflake using SnowSQL, from installation to secure authentication. With SnowSQL, you’re equipped to run SQL queries and manage data in Snowflake seamlessly from your terminal. This foundation will help you utilize Snowflake’s full potential for efficient data operations.