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:

  1. Laden Sie die Snowflake CLI deb aus dem Snowflake-CLI-Repository herunter.

  2. Installieren Sie das Paket, indem Sie den folgenden Befehl ausführen:

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

So installieren Sie Snowflake CLI mithilfe des rpm-Paketmanagers:

  1. Laden Sie das Paket Snowflake CLI rpm aus dem Snowflake-CLI-Repository herunter.

  2. Installieren Sie das Paket, indem Sie den folgenden Befehl ausführen:

    sudo rpm -i snowflake-cli-<version>.deb
    
    Copy
  3. Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:

    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. Snowflake-Verbindung konfigurieren

Installieren Sie mit dem MacOS-Paket-Installationsprogramm

Um Snowflake CLI auf MacOS zu installieren, gehen Sie wie folgt vor:

  1. Laden Sie das Installationsprogramm Snowflake CLI aus dem Snowflake-CLI-Repository herunter.

  2. Starten Sie das Installationsprogramm und folgen Sie den Anweisungen, um Snowflake CLI zu installieren.

  3. 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
    
    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. Snowflake-Verbindung konfigurieren

Installation mit dem Windows-Installationsprogramm

Um Snowflake CLI unter Windows zu installieren, gehen Sie wie folgt vor:

  1. Laden Sie das Installationsprogramm Snowflake CLI aus dem Snowflake-CLI-Repository herunter.

  2. Starten Sie das Installationsprogramm und folgen Sie den Anweisungen, um Snowflake CLI zu installieren.

  3. 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
    
    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. Snowflake-Verbindung konfigurieren

Mit Homebrew installieren

Wenn Sie ein Mac-Betriebssystem verwenden, können Sie Snowflake CLI mit Homebrew installieren.

  1. Installieren Sie Homebrew, falls erforderlich.

  2. Um Homebrew Zugriff auf das Snowflake CLI-Repository zu geben, führen Sie den folgenden Befehl aus:

    brew tap snowflakedb/snowflake-cli
    brew update
    
    Copy
  3. Um Snowflake CLI zu installieren, führen Sie den folgenden Befehl aus:

    brew install snowflake-cli
    
    Copy
  4. Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:

    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. Snowflake-Verbindung konfigurieren

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.

  1. Führen Sie den folgenden Shell-Befehl aus:

    pip install snowflake-cli
    
    Copy
  2. Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:

    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. Snowflake-Verbindung konfigurieren

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.

  1. Führen Sie den folgenden Shell-Befehl aus:

    pipx install snowflake-cli-labs
    
    Copy
  2. Um zu überprüfen, ob die Software erfolgreich installiert wurde, führen Sie den folgenden Befehl aus:

    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. Snowflake-Verbindung konfigurieren

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:

  1. Führen Sie den snow --install-completion-Befehl aus:

    snow --install-completion
    
    Copy
    zsh completion installed in <user home>/.zfunc/_snow
    Completion will take effect once you restart the terminal
    
  2. 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
    
    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. Wählen Sie den Befehlsausgabetext aus, und kopieren Sie ihn.

  4. Ö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
    
  5. Speichern Sie die Datei.

  6. Um die Funktionalität der Registerkartenvervollständigung zu aktivieren, starten Sie Ihre Shell oder Shell-Profildatei neu mit source, z. B:

    source ~/.bashrc
    
    Copy
  7. Um das Feature zu testen, geben Sie einen „snow“-Befehl gefolgt von einem TAB ein:

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