Installieren von Snowflake CLI¶
Unter diesem Thema wird erklärt, wie Sie Snowflake CLI auf unterstützten Plattformen installieren. Beachten Sie, dass Snowflake CLI derzeit nicht für AIX-Systeme verfügbar ist.
Snowflake empfiehlt die Verwendung binärer Installationsmethoden, wie z. B. Paketmanagement, um Snowflake CLI auf Ihrem System zu installieren. Sie können die binären Installationsprogramme aus dem offiziellen Snowflake CLI-Repository herunterladen.
Anforderungen¶
Bevor Sie Snowflake CLI nutzen können, müssen Sie über ein gültiges Snowflake-Konto verfügen.
Um Streamlit in Snowflake unter Snowflake CLI ausführen zu können, müssen Sie über ein Snowflake-Konto mit der Berechtigung zur Nutzung von Streamlit verfügen.
Um Snowpark Container Services in Snowflake unter Verwendung von Snowflake CLI ausführen zu können, müssen Sie über ein Snowflake-Konto mit Berechtigungen zur Nutzung von Snowpark Container Services verfügen.
Tipp
Wenn für Ihr Snowflake-Konto-MFA (mehrstufige Authentifizierung) erforderlich ist, benötigt Snowflake CLI für jeden Befehl eine Genehmigung. Sie können MFA-Caching verwenden, um die Authentifizierung nur einmal alle vier Stunden zu verlangen. Weitere Informationen dazu finden Sie unter Verwenden Sie eine mehrstufige Authentifizierung (MFA).
Snowflake CLI mit Paketmanagern installieren¶
Um Snowflake CLI über plattformspezifische Paketmanager zu installieren, verwenden Sie eine der folgenden Prozeduren:
Installation mit Linux Paketmanagern¶
Wenn Sie ein Linux-Betriebssystem verwenden, können Sie Snowflake CLI mit Paketmanagern installieren, die Folgendes unterstützen:
deb
-Pakete,rpm
-Pakete.
So installieren Sie Snowflake CLI mithilfe des deb
-Paketmanagers:
Laden Sie die Snowflake CLI
deb
aus dem Snowflake-CLI-Repository herunter.Installieren Sie das Paket, indem Sie den folgenden Befehl ausführen:
sudo dpkg -i snowflake-cli-<version>.deb
So installieren Sie Snowflake CLI mithilfe des rpm
-Paketmanagers:
Laden Sie das Paket Snowflake CLI
rpm
aus dem Snowflake-CLI-Repository herunter.Installieren Sie das Paket, indem Sie den folgenden Befehl ausführen:
sudo rpm -i snowflake-cli-<version>.deb
Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Installieren Sie mit dem MacOS-Paket-Installationsprogramm¶
Um Snowflake CLI auf MacOS zu installieren, gehen Sie wie folgt vor:
Laden Sie das Installationsprogramm Snowflake CLI aus dem Snowflake-CLI-Repository herunter.
Starten Sie das Installationsprogramm und folgen Sie den Anweisungen, um Snowflake CLI zu installieren.
Um zu überprüfen, ob die Software erfolgreich installiert wurde, öffnen Sie ein neues Terminal und führen Sie den folgenden Befehl aus:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Installation mit dem Windows-Installationsprogramm¶
Um Snowflake CLI unter Windows zu installieren, gehen Sie wie folgt vor:
Laden Sie das Installationsprogramm Snowflake CLI aus dem Snowflake-CLI-Repository herunter.
Starten Sie das Installationsprogramm und folgen Sie den Anweisungen, um Snowflake CLI zu installieren.
Um zu überprüfen, ob die Software erfolgreich installiert wurde, öffnen Sie ein neues Terminal und führen Sie den folgenden Befehl aus:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Mit Homebrew installieren¶
Wenn Sie ein Mac-Betriebssystem verwenden, können Sie Snowflake CLI mit Homebrew installieren.
Installieren Sie Homebrew, falls erforderlich.
Um Homebrew Zugriff auf das Snowflake CLI-Repository zu geben, führen Sie den folgenden Befehl aus:
brew tap snowflakedb/snowflake-cli brew update
Um Snowflake CLI zu installieren, führen Sie den folgenden Befehl aus:
brew install snowflake-cli
Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Installieren mit pip (PyPi)¶
Bemerkung
Diese Methode ändert die Python-Umgebung, in der Sie Snowflake CLI installieren. Ziehen Sie stattdessen die Verwendung von pipx in Betracht, um Abhängigkeitskonflikte zu vermeiden.
Um Snowflake CLI mit pip
zu installieren, müssen Sie Python Version 3.10 oder höher installiert haben.
Führen Sie den folgenden Shell-Befehl aus:
pip install snowflake-cli
Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Mit pipx installieren¶
pipx bietet eine Alternative zu pip
, das Python-Pakete in isolierten virtuellen Umgebungen installiert und ausführt. Die Installation von Snowflake CLI mit pipx
verändert also nicht Ihre aktuelle Python-Umgebung.
Um Snowflake CLI mit :codenowrap zu installieren:pipx
, müssen Sie pipx installiert haben.
Führen Sie den folgenden Shell-Befehl aus:
pipx install snowflake-cli-labs
Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Automatische Befehlsvervollständigung installieren¶
Snowflake CLI unterstützt die Standardfunktionalität zur Shell-Tab-Vervollständigung.
Um die automatische Vervollständigung in Snowflake CLI zu installieren, führen Sie die folgenden Schritte aus:
Führen Sie den
snow --install-completion
-Befehl aus:snow --install-completion
zsh completion installed in <user home>/.zfunc/_snow Completion will take effect once you restart the terminal
Führen Sie den
snow --show-completion
-Befehl aus, um die Befehle zu generieren, die Sie zu Ihrem Shell-Profil hinzufügen müssen (.bashrc
,.bash_profile
,.zshrc
und andere):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
Wählen Sie den Befehlsausgabetext aus, und kopieren Sie ihn.
Öffnen Sie Ihre Shell-Profil-Datei (in diesem Beispiel
.bashrc
) und fügen Sie den kopierten Text ein: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
Speichern Sie die Datei.
Um die Funktionalität der Registerkartenvervollständigung zu aktivieren, starten Sie Ihre Shell oder Shell-Profildatei neu mit
source
, z. B:source ~/.bashrc
Um das Feature zu testen, geben Sie einen „snow“-Befehl gefolgt von einem
TAB
ein:snow app [TAB]
deploy init open run teardown version