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
:
Baixe Snowflake CLI
deb
do repositório de Snowflake CLI.Instale o pacote executando o seguinte comando:
sudo dpkg -i snowflake-cli-<version>.deb
Para instalar Snowflake CLI usando o gerenciador de pacote rpm
:
Baixe o pacote Snowflake CLI
rpm
do repositório de Snowflake CLI.Instale o pacote executando o seguinte comando:
sudo rpm -i snowflake-cli-<version>.deb
Para verificar se o software foi instalado com sucesso, execute o seguinte comando:
snow --help
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Instalação com o instalador de pacote MacOS¶
Para instalar Snowflake CLI em MacOS, faça o seguinte:
Baixe o instalador de Snowflake CLI do repositório de Snowflake CLI.
Execute o instalador e siga as instruções para instalar Snowflake CLI.
Para verificar se o software foi instalado com sucesso, abra um novo terminal e execute o seguinte comando:
snow --help
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Instalação com o instalador do Windows¶
Para instalar Snowflake CLI no Windows, faça o seguinte:
Baixe o instalador de Snowflake CLI do repositório de Snowflake CLI.
Execute o instalador e siga as instruções para instalar Snowflake CLI.
Para verificar se o software foi instalado com sucesso, abra um novo terminal e execute o seguinte comando:
snow --help
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Instalação com Homebrew¶
Se você usa um sistema operacional Mac, é possível instalar Snowflake CLI com o Homebrew.
Instale o Homebrew, se necessário.
Para dar ao Homebrew acesso ao repositório de Snowflake CLI, execute o seguinte comando:
brew tap snowflakedb/snowflake-cli brew update
Para instalar Snowflake CLI, execute o seguinte comando:
brew install snowflake-cli
Para verificar se o software foi instalado com sucesso, execute o seguinte comando:
snow --help
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
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.
Execute o seguinte comando shell:
pip install snowflake-cli
Para verificar se o software foi instalado com sucesso, execute o seguinte comando:
snow --help
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
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.
Execute o seguinte comando shell:
pipx install snowflake-cli-labs
Para verificar se o software foi instalado com sucesso, execute o seguinte comando:
snow --help
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
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:
Execute o comando
snow --install-completion
:snow --install-completion
zsh completion installed in <user home>/.zfunc/_snow Completion will take effect once you restart the terminal
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
_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
Selecione e copie o texto de saída do comando.
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
Salve o arquivo.
Para ativar a funcionalidade de autocompletar, reinicie seu shell ou execute o comando
source
no arquivo de perfil do shell, como:source ~/.bashrc
Para testar o recurso, insira um comando snow seguido por um
TAB
, conforme mostrado:snow app [TAB]
deploy init open run teardown version