Instalação do Snowflake CLI

Este tópico explica como instalar Snowflake CLI em plataformas compatíveis. Observe que Snowflake CLI não está disponível atualmente para sistemas AIX.

A Snowflake recomenda usar métodos de instalação binário, como gerenciadores de pacote, para instalar Snowflake CLI em seu sistema. É possível baixar os instaladores binário do repositório de Snowflake CLI oficial.

Requisitos

  • Antes de usar o Snowflake CLI, você deve ter uma conta Snowflake válida.

  • Para executar o Streamlit no Snowflake usando Snowflake CLI, você deve ter uma conta Snowflake com permissão para usar o Streamlit.

  • Para executar o Snowpark Container Services no Snowflake usando Snowflake CLI, você deve ter uma conta Snowflake com privilégios para usar o Snowpark Container Services.

Dica

Se sua conta Snowflake exigir autenticação multifator (MFA), Snowflake CLI precisará de aprovação para cada comando. É possível usar o cache de MFA para exigir autenticação apenas uma vez a cada quatro horas. Para obter mais informações, consulte Como usar autenticação multifator (MFA).

Instalação do Snowflake CLI usando gerenciadores de pacotes

Para instalar Snowflake CLI usando gerenciadores de pacote específicos da plataforma, use um dos seguintes procedimentos:

Instalação com gerenciadores de pacote Linux

Se você usa um sistema operacional Linux, é possível instalar Snowflake CLI com gerenciadores de pacote que suportam o seguinte:

  • Pacotes deb

  • Pacotes rpm

Para instalar Snowflake CLI usando o gerenciador de pacote deb:

  1. Baixe Snowflake CLI deb do repositório de Snowflake CLI.

  2. Instale o pacote executando o seguinte comando:

    sudo dpkg -i snowflake-cli-<version>.deb
    
    Copy

Para instalar Snowflake CLI usando o gerenciador de pacote rpm:

  1. Baixe o pacote Snowflake CLI rpm do repositório de Snowflake CLI.

  2. Instale o pacote executando o seguinte comando:

    sudo rpm -i snowflake-cli-<version>.deb
    
    Copy
  3. Para verificar se o software foi instalado com sucesso, execute o seguinte comando:

    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]                       │
    │ --install-completion                Install completion for the current shell.                                                            │
    │ --show-completion                   Show completion for the current shell, to copy it or customize the installation.                     │
    │ --help                -h            Show this message and exit.                                                                          │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app          Manages a Snowflake Native App                                                                                              │
    │ connection   Manages connections to Snowflake.                                                                                           │
    │ cortex       Provides access to Snowflake Cortex.                                                                                        │
    │ git          Manages git repositories in Snowflake.                                                                                      │
    │ notebook     Manages notebooks 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.                                                                                       │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    
  4. Configuração da conexão do Snowflake.

Instalação com o instalador de pacote MacOS

Para instalar Snowflake CLI em MacOS, faça o seguinte:

  1. Baixe o instalador de Snowflake CLI do repositório de Snowflake CLI.

  2. Execute o instalador e siga as instruções para instalar Snowflake CLI.

  3. Para verificar se o software foi instalado com sucesso, abra um novo terminal e execute o seguinte comando:

    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]                       │
    │ --install-completion                Install completion for the current shell.                                                            │
    │ --show-completion                   Show completion for the current shell, to copy it or customize the installation.                     │
    │ --help                -h            Show this message and exit.                                                                          │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app          Manages a Snowflake Native App                                                                                              │
    │ connection   Manages connections to Snowflake.                                                                                           │
    │ cortex       Provides access to Snowflake Cortex.                                                                                        │
    │ git          Manages git repositories in Snowflake.                                                                                      │
    │ notebook     Manages notebooks 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.                                                                                       │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    
  4. Configuração da conexão do Snowflake.

Instalação com o instalador do Windows

Para instalar Snowflake CLI no Windows, faça o seguinte:

  1. Baixe o instalador de Snowflake CLI do repositório de Snowflake CLI.

  2. Execute o instalador e siga as instruções para instalar Snowflake CLI.

  3. Para verificar se o software foi instalado com sucesso, abra um novo terminal e execute o seguinte comando:

    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]                       │
    │ --install-completion                Install completion for the current shell.                                                            │
    │ --show-completion                   Show completion for the current shell, to copy it or customize the installation.                     │
    │ --help                -h            Show this message and exit.                                                                          │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app          Manages a Snowflake Native App                                                                                              │
    │ connection   Manages connections to Snowflake.                                                                                           │
    │ cortex       Provides access to Snowflake Cortex.                                                                                        │
    │ git          Manages git repositories in Snowflake.                                                                                      │
    │ notebook     Manages notebooks 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.                                                                                       │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    
  4. Configuração da conexão do Snowflake.

Instalação com Homebrew

Se você usa um sistema operacional Mac, é possível instalar Snowflake CLI com o Homebrew.

  1. Instale o Homebrew, se necessário.

  2. Para dar ao Homebrew acesso ao repositório de Snowflake CLI, execute o seguinte comando:

    brew tap snowflakedb/snowflake-cli
    brew update
    
    Copy
  3. Para instalar Snowflake CLI, execute o seguinte comando:

    brew install snowflake-cli
    
    Copy
  4. Para verificar se o software foi instalado com sucesso, execute o seguinte comando:

    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]                       │
    │ --install-completion                Install completion for the current shell.                                                            │
    │ --show-completion                   Show completion for the current shell, to copy it or customize the installation.                     │
    │ --help                -h            Show this message and exit.                                                                          │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app          Manages a Snowflake Native App                                                                                              │
    │ connection   Manages connections to Snowflake.                                                                                           │
    │ cortex       Provides access to Snowflake Cortex.                                                                                        │
    │ git          Manages git repositories in Snowflake.                                                                                      │
    │ notebook     Manages notebooks 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.                                                                                       │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    
  5. Configuração da conexão do Snowflake.

Instalação com pip (PyPi)

Nota

Este método modifica o ambiente Python onde você instala o Snowflake CLI. Considere usar pipx em vez disso, para evitar conflitos de dependência.

Para instalar Snowflake CLI usando pip, é necessário ter o Python versão 3.10 ou posterior instalado.

  1. Execute o seguinte comando shell:

    pip install snowflake-cli
    
    Copy
  2. Para verificar se o software foi instalado com sucesso, execute o seguinte comando:

    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]                       │
    │ --install-completion                Install completion for the current shell.                                                            │
    │ --show-completion                   Show completion for the current shell, to copy it or customize the installation.                     │
    │ --help                -h            Show this message and exit.                                                                          │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app          Manages a Snowflake Native App                                                                                              │
    │ connection   Manages connections to Snowflake.                                                                                           │
    │ cortex       Provides access to Snowflake Cortex.                                                                                        │
    │ git          Manages git repositories in Snowflake.                                                                                      │
    │ notebook     Manages notebooks 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. Configuração da conexão do Snowflake.

Instalação com pipx

pipx fornece uma alternativa ao pip que instala e executa pacotes Python em ambientes virtuais isolados. Portanto, a instalação de Snowflake CLI com pipx não modifica seu ambiente Python atual.

Para instalar Snowflake CLI usando pipx, é necessário ter pipx instalado.

  1. Execute o seguinte comando shell:

    pipx install snowflake-cli-labs
    
    Copy
  2. Para verificar se o software foi instalado com sucesso, execute o seguinte comando:

    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]                       │
    │ --install-completion                Install completion for the current shell.                                                            │
    │ --show-completion                   Show completion for the current shell, to copy it or customize the installation.                     │
    │ --help                -h            Show this message and exit.                                                                          │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ app          Manages a Snowflake Native App                                                                                              │
    │ connection   Manages connections to Snowflake.                                                                                           │
    │ cortex       Provides access to Snowflake Cortex.                                                                                        │
    │ git          Manages git repositories in Snowflake.                                                                                      │
    │ notebook     Manages notebooks 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. Configuração da conexão do Snowflake.

Instalação da funcionalidade de preenchimento automático de comando

Snowflake CLI oferece suporte à funcionalidade padrão de preenchimento de tabulação do shell.

Para instalar o preenchimento automático em Snowflake CLI, execute os seguintes passos:

  1. Execute o comando snow --install-completion:

    snow --install-completion
    
    Copy
    zsh completion installed in <user home>/.zfunc/_snow
    Completion will take effect once you restart the terminal
    
  2. Execute o comando snow --show-completion para gerar os comandos que você precisa adicionar ao seu perfil shell (.bashrc, .bash_profile, .zshrc, dentre outros):

    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. Selecione e copie o texto de saída do comando.

  4. Abra seu arquivo de perfil de shell, .bashrc neste exemplo, e cole o texto copiado:

    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. Salve o arquivo.

  6. Para ativar a funcionalidade de autocompletar, reinicie seu shell ou execute o comando source no arquivo de perfil do shell, como:

    source ~/.bashrc
    
    Copy
  7. Para testar o recurso, insira um comando snow seguido por um TAB, conforme mostrado:

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