In this blog, you will learn all about SnowSQL, including how to download and install SnowSQL and how to connect SnowSQL with Snowflake.
What is SnowSQL?
SnowSQL is a command-line tool provided by Snowflake, a popular cloud-based data warehousing and analytics platform.
SnowSQL is designed to interact with Snowflake databases and perform various tasks, such as executing SQL queries, loading data into Snowflake, and managing database objects.
SnowSQL can be used for
- Execute SQL queries to select, insert, update, and delete data.
- Load and unload data into and out of Snowflake.
- Create and manage databases, schemas, and tables.
- Create and manage users, roles, and privileges.
- Monitor and manage Snowflake resources.
Download and Install SnowSQL
SnowSQL is available for Linux, macOS, and Windows. It can be installed from the Snowflake website or from the package manager for your operating system.
You can download SnowSQL from the Snowflake website. link
To install SnowSQL on Windows:
- Double-click the
.msifile in the download location to run the installer MSI file.
- Follow the instructions provided by the installer.
Connect SnowSQL with Snowflake
To connect to Snowflake using SnowSQL, you will need to provide the account identifier, username, and password for your Snowflake user account.
Step-1: Find your account identifier: Log in to your Snowflake account, and on the bottom left side, click on the down arrow icon to view your account identifier and make a note of it for future reference.
See the image below for your reference.
Step-2: Open a new terminal window.
Step-3: Execute the following command to establish a connection to Snowflake, and then enter your Snowflake account password.
snowsql -a <account_identifier> -u <username>
- <account_identifier>: The account identifier of your Snowflake account.
- <username>: The username of your Snowflake user account.
Note: When you copy the Account ID, it may contain a
DOT. Please replace it with a
DASH after pasting it.
Step-4: Use the following commands individually to establish the context for database objects.
USE ROLE ACCOUNTADMIN; USE WAREHOUSE COMPUTE_WH; USE DATABASE DEVDB; USE SCHEMA PUBLIC;
Replace with your role, warehouse, database and schema name.
Step-5: SnowSQL suggests objects names when you hit the spacebar in a query.
Step-6: Select data from table.
Thank you for reading this post, and I hope you enjoyed it!