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>.rpm
    
    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ções locais avançadas

Você também pode instalar o Snowflake CLI como um pacote Python usando uma das seguintes opções:

A Snowflake recomenda a instalação como um pacote Python apenas para fins de desenvolvimento ou quando a instalação de binários não for possível em seu ambiente.

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
    
    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 do Snowflake CLI em ambientes compatíveis com FIPS

Você pode usar uma imagem Docker para instalar o Snowflake CLI em um ambiente compatível com FIPS (Padrões Federal de Processamento de Informações).

Pré-requisitos

Antes de instalar o Snowflake CLI em um FIPSEm um ambiente compatível com, certifique-se de que você atenda aos seguintes pré-requisitos:

  • FIPSPython compatível com: O Python deve ser pré-instalado, criado e configurado para FIPS Conformidade com o. Isso normalmente significa que o Python está vinculado a um FIPShabilitado para OpenSSL Biblioteca.

  • ** OpenSSL habilitado para FIPS**: do sistema OpenSSL As bibliotecas devem ser FIPSEm conformidade com e disponível para Python em tempo de execução.

  • Ferramentas de construção: Ferramentas de compilação padrão (como um compilador C e cabeçalhos de desenvolvimento Python) devem estar disponíveis, pois as dependências serão criadas a partir da fonte.

  • Acesso à rede: O ambiente deve permitir o acesso ao PyPI ou seu índice interno de pacotes para baixar as distribuições de origem.

Instalar o Snowflake CLI em um Dockerfile compatível com FIPS

Para instalar o Snowflake CLI em um FIPScompatível com, siga estas etapas:

  1. Crie um ambiente virtual Python no contêiner, conforme mostrado no exemplo a seguir:

    python -m venv .venv
    
    Copy
  2. Ative o ambiente virtual Python no contêiner, conforme mostrado no exemplo a seguir:

    source ~/.venv/bin/activate
    
    Copy
  3. Atualização de pip e ferramentas de configuração no contêiner, conforme mostrado no exemplo a seguir:

    pip install -U setuptools pip
    
    Copy
  4. Instale a criptografia, o conector Python e Snowflake CLI Dependências da fonte no contêiner, conforme mostrado no exemplo a seguir. Observe que todas as dependências devem ser instaladas a partir da fonte para garantir que sejam construídas em sua FIPSBibliotecas compatíveis com.

    pip install cryptography==44.0.3 --no-binary cryptography
    pip install -U snowflake-connector-python[secure-local-storage] --no-binary snowflake-connector-python[secure-local-storage]
    pip install -U snowflake-cli --no-binary snowflake-cli
    
    Copy

    A instrução --no-binary A opção força a instalação da fonte, garantindo que as compilações utilizem FIPSBibliotecas prontas para.

Validação da imagem Docker

Para confirmar que seu ambiente Python usa um FIPShabilitado para OpenSSL Biblioteca, insira o seguinte comando no contêiner em execução:

python -c "import ssl; print(ssl.OPENSSL_VERSION)"
Copy

Após a instalação do Snowflake CLI e validando a imagem Docker, você pode usar Snowflake CLI no contêiner.

snow <your-command>
Copy

onde <your-command> é qualquer válido Snowflake CLI Comando, como snow --help.

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