sf cl tool
Home » Snowflake » SnowSQL: Command-Line Tool for Snowflake

SnowSQL: Command-Line Tool for Snowflake

In this blog, you will learn all about SnowSQL, including how to download and install SnowSQL and how to connect SnowSQL with Snowflake.

Post Content

What is SnowSQL?

Download and Install SnowSQL

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

Download SnowSQL

Download SnowSQL

To install SnowSQL on Windows:

  1. Double-click the .msi file in the download location to run the installer MSI file.
  2. Follow the instructions provided by the installer.
Install SnowSQL

Install SnowSQL



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.

Account Identifier

Account Identifier

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.

Connect with SnowSQL

Connect with SnowSQL

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.

setup database objects

setup database objects

Step-5: SnowSQL suggests objects names when you hit the spacebar in a query.

SnowSQL object suggestions

SnowSQL object suggestions

Step-6: Select data from table.

SnowSQL select Query

SnowSQL select Query

Thank you for reading this post, and I hope you enjoyed it!

Leave a Reply