Setup Of Snowsql And Connecting Snowsql Using Command Line Interface | How To Connect To Snowflake Using Snowsql

Snowflake is a cloud-based data-warehouse solution. Snowflake works with all major cloud services provider like AWS, Azure, and Google cloud. Snowflake web interface provides a similar query environment as Oracle, and SQL Server to query the data.

  1. What is snowsql?
  2. Installation and configuration of snowsql.
  3. How to get the version of installed snowsql?
  4. Connecting with Snowflake using snowsql and querying the database.
    1. By specifying the account name, user name, and password.
    2. By using named connections in the snowsql configuration file.
    3. By using Key Pair Authentication.
  5. How to disconnect from SnowSQL?
  6. What is the latest version of SnowSQL?
  7. What is Snowflake architecture?

1. What is snowsql?

Snowflake is a cloud-based data warehouse solution and SnowSQL is a CLI tool used to interact with Snowflake. A CLI (command-line interface) tool is software that processes commands in the form of lines of text. The program which handles the interface is called a command-line interpreter.
SnowSQL is the command line client for connecting to Snowflake to execute SQL queries and perform all DDL and DML operations. Using SnowSQL we can load data or export data out of database tables.

2. Installation and configuration of snowsql.

Using SnowSQL, you can control all aspects of your Snowflake Data Cloud, including uploading data, querying data, changing data, and deleting data. This guide will review SnowSQL and use it to create a database, load data, and learn helpful commands to manage your tables and data directly from your CLI.

Please follow the official guideline to install Snowsql on Windows/Linux or Mac OS.

1. Installation on the windows

Download the MSI package from the below link and double click and follow the instruction by the installer.

https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/windows_x86_64/snowsql-1.2.22-windows_x86_64.msi

2. Installation on Linux

  1. Download the rpm package from the below link and double click on it and follow the pop-up instruction.
    https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/index.html
  2. Use the curl command to download the package

3. How to get the version of installed snowsql?

To get the installed version of snowsql use the below command
snowsql -v

4. Connecting with Snowflake using snowsql and querying the database.

There are multiple ways in which we can connect to Snowflake using snowsql.

    1. By specifying the account name, user name, and password.

      Connecting to the snowflake environment by specifying the account name, user, and password as a parameter
      snowsql -a <account_identifier> -u <username> -d <database> -s <schema> -w<warehouse>

      snowsql to connect with snowflake and query data

    2. By using named connections in the snowsql configuration file.

      Add the connection detail as below into the snowsql configuration file ~/.snowsql/config
      [connections.conn_sf_sample_db]
      accountname = <accountname>
      username = <user_name>
      password = <password>
      dbname = SNOWFLAKE_SAMPLE_DATA
      schemaname = TPCH_SF10
      warehousename = COMPUTE_WH

      Use the below command to connect with the snowflake environment.
      snowsql -c conn_sf_sample_db

      snowsql connection using named connection in snowsql config file

    3. By using Key Pair Authentication. 

      To use the  key pair authentication, we generate the private key & public key pair. Once the public key is generated we will assign the public key to the existing snowflake user.
      I am working on a detailed article on this topic to use key pair authentication to connect with the snowflake environment.

5. How to disconnect from SnowSQL?

You can disconnect from the snowsql using the below command

  1. !quit
  2. !q
  3. Ctrl + D

6. What is the latest version of SnowSQL?

As of now (Dec 25, 2022) the latest version of snowsql is 1.2.24

for all the versions of snowsql please go to the official link https://developers.snowflake.com/snowsql/.

7. What is Snowflake architecture?

For detail related to snowflake architecture please visit our previous article on snowflake architecture.

Snowflake Architecture Deep Dive

What is a Snowflake Data Warehouse?

Jump to the top of the page↵

Below are my previous articles

15 thoughts on “Setup Of Snowsql And Connecting Snowsql Using Command Line Interface | How To Connect To Snowflake Using Snowsql”

  1. friseur dresden

    Somebody necessarily assist to make seriously posts
    I might state. That is the very first time I frequented your web page and thus
    far? I amazed with the analysis you made to create this particular publish
    extraordinary. Magnificent activity!

  2. soharindustriesspc.com

    I comment each time I especially enjoy a article on a site
    or if I have something to valuable to contribute to the conversation.
    Usually it’s triggered by the passion communicated in the article I looked at.
    And after this article Setup Of Snowsql And Connecting Snowsql Using Command Line Interface | How To Connect To Snowflake
    Using Snowsql – Mycloudplace. I was actually excited enough to
    post a thought 😉 I actually do have a couple of questions for you if you do not mind.
    Could it be simply me or do some of these comments
    look like they are coming from brain dead visitors? 😛 And,
    if you are posting on additional online sites, I would like to follow you.
    Could you make a list all of your social sites like your Facebook page, twitter feed, or linkedin profile?

  3. Hey,

    Don’t pay thousands of dollars for a mobile app, we provide iOS and Android apps for your website at less than $200.

    Visit our website awolfcreations.com and see some examples.

    Kind Regards
    awolfcreations.com Team

  4. Have you ever considered about adding a little bit more than just your articles?
    I mean, what you say is valuable and everything. Nevertheless imagine if you added some great graphics or
    videos to give your posts more, “pop”! Your content is excellent but with images
    and clips, this site could definitely be one of the best in its
    field. Good blog!

  5. 2023 daily calendar printable

    Thanks for a marvelous posting! I genuinely enjoyed reading it, you can be a great author.
    I will ensure that I bookmark your blog and definitely will come back
    someday. I want to encourage that you continue your great posts,
    have a nice evening!

  6. 色情男女色情片

    Grat post. I wwas checking continuusly ths blogg andd I am impressed!
    Extremely useful ingo spedcially the lastt art :
    ) I carre ffor succh inforkation much. I was seeking thks certain info for a ery long time.
    Tank yyou and beset oof luck.

  7. It’s awesome to pay a visit this web site and reading
    the views of all friends on the topic of this piece of writing,
    while I am also keen of getting knowledge.

  8. Everything is very open with a precise explanation of
    the issues. It was definitely informative. Your site is very useful.
    Many thanks for sharing!

  9. Amazing! This blog looks exactly like my old one!

    It’s on a totally different subject but it has pretty
    much the same layout and design. Excellent choice of colors!

Leave a Comment

Your email address will not be published. Required fields are marked *