Installing SnowSQL

This topic describes how to download SnowSQL and install it on all supported platforms. The SnowSQL installer is provided as a file that can be downloaded from the Snowflake web interface or as an artifact distributed through Amazon S3.

In addition, Snowflake is distributed as a package that can be installed through Homebrew Cask for macOS users.

Note

Downloading and installing SnowSQL is only required for major and minor versions. For patch versions (and builds), SnowSQL upgrades automatically by default. For more information, see What is Auto-upgrade? (in this topic).

In this Topic:

Downloading the SnowSQL Installer

The SnowSQL Installer can be downloaded from the Snowflake web interface or AWS S3.

Web Interface

To download the SnowSQL installer from the web interface web interface:

  1. In the Snowflake web interface, click Help Help tab » Download… to display the Downloads dialog.

  2. Select CLI Client (snowsql) on the left, then click the download icon on the right for the installer that matches your client platform:

    Snowflake SnowSQL options in Downloads dialog

Note

  • The installer version available via the web interface can lag slightly behind the upgrade version. When you connect to Snowflake, SnowSQL automatically upgrades to the latest patch version. For more information, see What is Auto-upgrade?.

  • The Snowflake GPG Public Key file is provided to optionally verify the signature of the SnowSQL installer for Linux, if you download the package from Amazon S3. For information, see Amazon S3.

Amazon S3

You can download the SnowSQL installer directly from the S3 artifact repository. No authentication is required. To determine the latest SnowSQL version that is available, see Client Changes by Version.

Run curl (or an equivalent command line tool) to download the installer. The curl syntax is as follows:

$ curl -o snowsql-<version>-<os>.[bash|pkg|msi] https://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/<bootstrap_version>/<os>/snowsql-<version>-<os>.[bash|pkg|msi]

Where:

  • <version> is the combined SnowSQL major, minor, and patch versions. For example, for version 1.1.2, the major version is 1, the minor version is 1, and the patch version is 2. So, the version is 1.1.2.

  • <os> is the operating system for the client machine where SnowSQL will be installed.

  • <bootstrap_version> is the combined SnowSQL major and minor versions. For example, for version 1.1.2, the major version is 1 and the minor version is 1, so the bootstrap version is 1.1.

For more information about SnowSQL versions, see Understanding SnowSQL Versioning (in this topic).

Linux S3 URL

The S3 URL pattern for Linux is as follows:

http://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/<bootstrap_version>/linux_x86_64/snowsql-<version>-linux_x86_64.bash

For example, to download the SnowSQL installer where <bootstrap_version> is 1.1 and <version> is 1.1.84:

$ curl -o snowsql-1.1.84-linux_x86_64.bash http://s3-us-west-2.amazonaws.com/sfc-snowsql-updates/bootstrap/1.1/linux_x86_64/snowsql-1.1.84-linux_x86_64.bash

To optionally verify the signature for the downloaded package:

  1. Download and import the latest Snowflake GPG public key from the Snowflake web interface or the public keyserver.

    To download from the web interface,

    1. In the Snowflake web interface, click Help Help tab » Download… to display the Downloads dialog.

    2. Select CLI Client (snowsql) on the left, then click the Snowflake GPG Public Key icon on the right.

    To download from the keyserver:

    $ gpg --keyserver hkp://keys.gnupg.net --recv-keys EC218558EABB25A1

    Note

    If reinstalling SnowSQL version 1.1.74 or lower, use GPG key ID 93DB296A69BE019A instead of EC218558EABB25A1.

  2. Download the GPG signature along with the bash installer and verify the signature:

    $ curl -o snowsql-1.1.84-linux_x86_64.bash http://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/linux_x86_64/snowsql-1.1.84-linux_x86_64.bash
    $ curl -o snowsql-1.1.84-linux_x86_64.bash.sig http://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/linux_x86_64/snowsql-1.1.84-linux_x86_64.bash.sig
    $ gpg --verify snowsql-1.1.84-linux_x86_64.bash.sig snowsql-1.1.84-linux_x86_64.bash

    Note

    Verifying the signature produces a warning similar to the following:

    gpg: Signature made Mon 24 Sep 2018 03:03:45 AM UTC using RSA key ID <gpg_key_id>
    gpg: Good signature from "Snowflake Computing <snowflake_gpg@snowflake.net>" unknown
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg: There is no indication that the signature belongs to the owner.
    

    To avoid the warning, you could grant the Snowflake GPG public key implicit trust.

  3. Your local environment can contain multiple GPG keys; however, for security reasons, Snowflake periodically rotates the public GPG key. As a best practice, we recommend deleting the existing public key after confirming that the latest key works with the latest signed package. For example:

    $ gpg --delete-key "Snowflake Computing"
    

macOS S3 URL

The S3 URL pattern for macOS is as follows:

http://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/<bootstrap_version>/darwin_x86_64/snowsql-<version>-darwin_x86_64.pkg

For example, to download the SnowSQL installer where <bootstrap_version> is 1.1 and <version> is 1.1.84:

$ curl -o snowsql-1.1.84-darwin_x86_64.pkg http://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/darwin_x86_64/snowsql-1.1.84-darwin_x86_64.pkg

The macOS operating system can verify the installer signature automatically, so GPG signature verification is not needed.

Windows S3 URL

The S3 URL pattern for Windows is as follows:

http://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/<bootstrap_version>/windows_x86_64/snowsql-<version>-windows_x86_64.msi

For example, to download the SnowSQL installer where <bootstrap_version> is 1.1 and <version> is 1.1.84:

$ curl -o snowsql-1.1.84-windows_x86_64.msi http://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/windows_x86_64/snowsql-1.1.84-windows_x86_64.msi

The Windows operating system can verify the installer signature automatically, so GPG signature verification is not needed.

Installing SnowSQL Using the Installer

Linux Install

  1. Open a terminal window.

  2. Run the Bash script installer:

    $ bash snowsql-linux_x86_64.bash
    
  3. Follow the instructions provided by the installer.

  4. Open a new terminal window to run snowsql.

Note

The installation can be automated by setting the following environment variables:

  • SNOWSQL_DEST: Target directory of the snowsql executable.

  • SNOWSQL_LOGIN_SHELL: The login shell initialization file, which includes the PATH environment update.

$ SNOWSQL_DEST=~/bin SNOWSQL_LOGIN_SHELL=~/.profile bash snowsql-linux_x86_64.bash

macOS Install

  1. Run the PKG file by double-clicking snowsql-darwin_x86_64.pkg.

  2. Follow the instructions provided by the installer.

  3. Open a new terminal window or double-click the SnowSQL application icon to run snowsql.

Note

Double-clicking the SnowSQL application icon starts snowsql in the current Terminal window, if one exists, or opens a new window to start the application. If you cannot see the window running snowsql, ensure the window is not minimized, hidden, or located on a second monitor.

Also, the installation can be automated by running the installer from the command line. The target directory can be set to either CurrentUserHomeDirectory (/Applications directory) or LocalSystem (~/Applications directory):

$ installer -pkg snowsql-darwin_x86_64.pkg -target CurrentUserHomeDirectory

Windows Install

  1. Run the MSI file by double-clicking snowsql-windows_x86_64.msi.

  2. Follow the instructions provided by the installer.

  3. Open a new terminal window to run snowsql.

Note

The installation can be automated by running the MSI installer msiexec from the command line. The target directory cannot be changed from %ProgramFiles%\Snowflake SnowSQL. For example:

C:\Users\snowflake> msiexec /i snowsql-windows_x86_64.msi /q

Installing SnowSQL Using Homebrew Cask (macOS Only)

Homebrew Cask is a popular extension of Homebrew used for package distribution, installation, and maintenance. There is no separate SnowSQL installer to download. If Homebrew Cask is installed on your macOS platform, you can install Snowflake directly.

Run the brew cask command:

$ brew cask install snowflake-snowsql

Understanding SnowSQL Versioning

SnowSQL version numbers consist of three digits: <major version>.<minor version>.<patch version>.

For example, version 1.1.2 indicates the major version is 1, the minor version is 1, the patch version is 2.

To determine the SnowSQL version that currently starts when you run the client, use the -v option without a value:

$ snowsql -v

  Version: 1.1.2

In general, the following guidelines apply to the different version types:

Major version

A change in the major version indicates dramatic improvements in the underlying Snowflake service. A new major version breaks backward compatibility. You will need to download and install the latest SnowSQL version from the web interface.

Minor version

A change in the minor version indicates improvements to support forward compatibility in either SnowSQL or the underlying Snowflake service. A new minor version does not break backward compatibility, but we strongly recommend that you download and install the latest SnowSQL version from the web interface.

Patch version

A change in the patch version indicates small enhancements or bug fixes were applied. The auto-upgrade feature automatically installs all patch versions.

Note

If a minor version is released, the functionality in your current version should continue to work, but any newly-released bug fixes and features will not be available via the auto-upgrade feature. Therefore, we strongly recommended that you download and install the latest SnowSQL version if the minor version is increased.

What is Auto-upgrade?

By default, SnowSQL upgrades itself automatically to the latest patch version. A new major or minor version requires a manual download and installation.

When a newer patch version is available, SnowSQL downloads the new binary in a background process and executes the current version. The next time you run SnowSQL, the new version starts.

To illustrate the process:

  1. For a fresh installation, you download the SnowSQL installer (e.g., version 1.1.2) using the Snowflake web interface and install the client.

  2. Each time you run SnowSQL, the client checks whether a newer version is available in the SnowSQL upgrade repository.

  3. If a newer version (e.g., version 1.1.3) is available, SnowSQL downloads it as a background process while the current installed version.

  4. The next time you run SnowSQL, the client executes version 1.1.3 while checking if a newer version is available.

Disabling Auto-upgrade

The --noup option prevents SnowSQL from downloading a new version, if available. You can specify this option while logging into Snowflake to prevent an auto-upgrade during that specific session.

For example:

$ snowsql --noup

Alternatively, add the noup = true option to the configuration file to prevent SnowSQL from auto-upgrading until the option is removed or set to false.

Running a Previous SnowSQL Version

If you encounter an issue with the latest SnowSQL version, e.g., version 1.1.2, you can temporarily run a previous version.

To determine the SnowSQL version that currently starts when you run the client, use the -v option without a value:

$ snowsql -v

  Version: 1.1.2

To display a list of available SnowSQL versions, use the --versions option:

$ snowsql --versions

  1.1.3
  1.1.2
  1.1.1

To install an earlier SnowSQL version from the list, use the -v option and specify the version you want to install. For example, to install version 1.1.3:

$ snowsql -v 1.1.3

  Installing version: 1.1.3  [####################################]  100%

Use the same option to specify the version you want to run when you start SnowSQL:

$ snowsql -v 1.1.3

Setting the Download Directory and Configuration File Location

By default, the SnowSQL Installer downloads the binaries to the following directory:

Linux/macOS

~/.snowsql

Windows

%USERPROFILE%\.snowsql

Consequently, the configuration file is located under the download directory:

Linux/macOS

~/.snowsql/config

Windows

%USERPROFILE%\.snowsql\config

You can change both the download directory and location of the configuration file by setting the WORKSPACE environment variable to any user-writable directory. This is particularly useful if you have an isolated SnowSQL environment for each process.

In addition, you can separate the download directory from the configuration file by setting the SNOWSQL_DOWNLOAD_DIR environment variable so that multiple SnowSQL processes can share the binaries. For example:

$ SNOWSQL_DOWNLOAD_DIR=/var/shared snowsql -h

Note that SNOWSQL_DOWNLOAD_DIR is supported starting with the SnowSQL 1.1.70 bootstrap version. To check the version you are using, execute the following command from the terminal window prompt:

$ snowsql --bootstrap-version