Installing Snowflake CLI

This topic explains how to install Snowflake CLI on all supported platforms.

Requirements

  • Before using Snowflake CLI, you must have a valid Snowflake account.

  • To run Streamlit in Snowflake using Snowflake CLI, you must have a Snowflake account with permission to use Streamlit.

  • To run Snowpark Container Services in Snowflake using Snowflake CLI, you must have a Snowflake account with privileges to use Snowpark Container Services.

Install Snowflake CLI using package managers

To install Snowflake CLI using package managers, use one of the following procedures:

How to install Snowflake CLI using pip (PyPi)

Note

This method modifies the Python environment where you install Snowflake CLI. Consider using pipx instead to avoid dependency conflicts.

To install Snowflake CLI using pip, you must have Python version 3.8 or later installed.

  1. Run the following shell command:

    pip install snowflake-cli-labs
    
    Copy
  2. To verify that the software was installed successfully, run the following command:

    snow --help
    
    Copy
    Usage: snow [OPTIONS] COMMAND [ARGS]...
    
    Snowflake CLI tool for developers.
    
    ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ --version                    Shows version of the Snowflake CLI                                                      │
    │ --info                       Shows information about the Snowflake CLI                                               │
    │ --config-file          FILE  Specifies Snowflake CLI configuration file that should be used [default: None]          │
    │ --help         -h            Show this message and exit.                                                             │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app          Manages a Snowflake Native App                                                                          │
    │ connection   Manages connections to Snowflake.                                                                       │
    │ git          Manages git repositories in Snowflake.                                                                  │
    │ object       Manages Snowflake objects like warehouses and stages                                                    │
    │ snowpark     Manages procedures and functions.                                                                       │
    │ spcs         Manages Snowpark Container Services compute pools, services, image registries, and image repositories.  │
    │ sql          Executes Snowflake query.                                                                               │
    │ stage        Manages stages.                                                                                         │
    │ streamlit    Manages a Streamlit app in Snowflake.                                                                   │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    
  3. Configure the Snowflake connection.

How to install Snowflake CLI using pipx

pipx provides an alternative to pip that installs and executes Python packages into isolated virtual environments. Installing Snowflake CLI with pipx does not, therefore, modify your current Python environment.

To install Snowflake CLI using pipx, you must have pipx installed.

  1. Run the following shell command:

    pipx install snowflake-cli-labs
    
    Copy
  2. To verify that the software was installed successfully, run the following command:

    snow --help
    
    Copy
    Usage: snow [OPTIONS] COMMAND [ARGS]...
    
    Snowflake CLI tool for developers.
    
    ╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ --version                    Shows version of the |sf-cli|                                                                │
    │ --info                       Shows information about the |sf-cli|                                                         │
    │ --config-file          FILE  Specifies |sf-cli| configuration file that should be used [default: None]                    │
    │ --help         -h            Show this message and exit.                                                                       │
    ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app           Manage Native Apps in Snowflake                                                                                  │
    │ connection    Manages connections to Snowflake.                                                                                │
    │ object        Manages Snowflake objects like warehouses and stages                                                             │
    │ snowpark      Manage procedures and functions.                                                                                 │
    │ spcs          Manages Snowpark Container Services compute pools, services, image registries, and image repositories.           │
    │ sql           Executes Snowflake query.                                                                                        │
    │ streamlit     Manages Streamlit in Snowflake.                                                                                  │
    ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    
  3. Configure the Snowflake connection.

Install command auto-completion functionality

Snowflake CLI supports standard shell tab completion functionality.

To install auto-completion into Snowflake CLI, perform the following steps:

  1. Run the snow --install-completion command:

    snow --install-completion
    
    Copy
    zsh completion installed in <user home>/.zfunc/_snow
    Completion will take effect once you restart the terminal
    
  2. Run the snow --show-completion command to generate the commands you need to add to your shell profile (.bashrc, .bash_profile, .zshrc, and others):

    snow --show-completion
    
    Copy
    _snow_completion() {
       local IFS=$'
    '
       COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
                      COMP_CWORD=$COMP_CWORD \
                      _SNOW_COMPLETE=complete_bash $1 ) )
       return 0
    }
    
    complete -o default -F _snow_completion snow
    
  3. Select and copy the command output text.

  4. Open your shell profile file, .bashrc in this example, and paste the copied text:

    export SHELL=/bin/bash
    
    ...
    
    _snow_completion() {
       local IFS=$'
    '
       COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
                      COMP_CWORD=$COMP_CWORD \
                      _SNOW_COMPLETE=complete_bash $1 ) )
       return 0
    }
    
    complete -o default -F _snow_completion snow
    
  5. Save the file.

  6. To activate the tab-completion functionality, restart your shell or source your shell profile file, such as:

    source ~/.bashrc
    
    Copy
  7. To test the feature, enter a snow command followed by a TAB, as shown:

    snow app [TAB]
    
    Copy
    deploy    init      open      run       teardown  version