Snowflake CLI のインストール¶
このトピックでは、 がサポートするすべてのプラットフォーム に Snowflake CLI をインストールする方法を説明します。なお、 Snowflake CLI は現在、 AIX システムでは利用できません。
Snowflakeでは、 Snowflake CLI をシステムにインストールするために、パッケージマネージャなどのバイナリインストール方法を使用することを推奨しています。バイナリー・インストーラーは、公式 Snowflake CLI リポジトリ からダウンロードできます。
要件¶
Snowflake CLI を使用する前に、有効なSnowflakeアカウントが必要です。
Snowflake CLI を使用してSnowflake Streamlitを実行するには、Streamlitの使用が許可されたSnowflakeアカウントが必要です。
Snowflake CLI を使用してSnowflakeでSnowpark Container Servicesを実行するには、Snowpark Container Servicesを使用する権限を持つSnowflakeアカウントが必要です。
Tip
Snowflakeアカウントに MFA (多要素認証)が必要な場合、 Snowflake CLI にはコマンドごとに承認が必要となります。MFA キャッシュを使うと、4時間に1度だけ認証が必要になります。詳細については、 多要素認証(MFA)を使用する をご参照ください。
パッケージマネージャーを使用して Snowflake CLI をインストールする¶
パッケージマネージャーを使用して Snowflake CLI をインストールするには、次のプロシージャのいずれかを使用します。
MacOS インストーラー を使ってインストールします。
Linuxパッケージマネージャーを使用してインストールする¶
Linuxオペレーティング・システムを使用している場合、以下をサポートするパッケージ・マネージャーを使ってインストールできます Snowflake CLI:
deb
パッケージ、rpm
パッケージ。
deb
パッケージマネージャを使って Snowflake CLI をインストールする:
Snowflake CLI リポジトリ から Snowflake CLI
deb
をダウンロードします。次のコマンドを実行してパッケージをアンインストールします:
sudo dpkg -i snowflake-cli-<version>.deb
rpm
パッケージマネージャを使って Snowflake CLI をインストールする:
Snowflake CLI repository から Snowflake CLI
rpm
パッケージをダウンロードします。次のコマンドを実行してパッケージをアンインストールします:
sudo rpm -i snowflake-cli-<version>.deb
ソフトウェアが正常にインストールされたことを確認するには、次のコマンドを実行します。
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
MacOS パッケージインストーラーでインストールする¶
MacOS に Snowflake CLI をインストールするには:
Snowflake CLI リポジトリ から Snowflake CLI インストーラをダウンロードします。
インストーラーを実行し、指示に従って Snowflake CLI をインストールします。
ソフトウェアが正常にインストールされたことを確認するには、次のコマンドを実行します:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Windowsインストーラーでインストールする¶
Windowsに Snowflake CLI をインストールするには、以下を行います:
Snowflake CLI リポジトリ から Snowflake CLI インストーラをダウンロードします。
インストーラーを実行し、指示に従って Snowflake CLI をインストールします。
ソフトウェアが正常にインストールされたことを確認するには、次のコマンドを実行します:
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Homebrewでインストールする¶
Mac OSをお使いの場合は、 Homebrew で Snowflake CLI をインストールできます。
必要であれば、 Homebrew をインストールします。
Homebrewに Snowflake CLI リポジトリへのアクセス権を与えるには、以下のコマンドを実行します:
brew tap snowflakedb/snowflake-cli brew update
Snowflake CLI をインストールするには、次のコマンドを実行します:
brew install snowflake-cli
ソフトウェアが正常にインストールされたことを確認するには、次のコマンドを実行します。
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
pipでインストールする (PyPi)¶
注釈
この方法は、 Snowflake CLI をインストールするPython環境を変更します。依存関係の衝突を避けるため、代わりに pipx を使用することを検討してください。
pip
を使用して Snowflake CLI をインストールするには、 Python バージョン3.10以降がインストールされている必要があります。
次のシェルコマンドを実行します。
pip install snowflake-cli
ソフトウェアが正常にインストールされたことを確認するには、次のコマンドを実行します。
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
pipxを使用してインストールする¶
pipx は、Pythonパッケージを分離された仮想環境にインストールして実行する:codenowrap:pip
の代替手段を提供します。従って、pip
で Snowflake CLI をインストールしても、現在のPython環境は変更されません。
pipx
を使用して Snowflake CLI をインストールするには、 pipx がインストールされている必要があります。
次のシェルコマンドを実行します。
pipx install snowflake-cli-labs
ソフトウェアが正常にインストールされたことを確認するには、次のコマンドを実行します。
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. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
コマンドオートコンプリート機能のインストール¶
Snowflake CLI は標準的なシェルタブコンプリート機能をサポートしています。
Snowflake CLI にオートコンプリートをインストールするには、次のステップを実行します。
snow --install-completion
コマンドを実行します:snow --install-completion
zsh completion installed in <user home>/.zfunc/_snow Completion will take effect once you restart the terminal
snow --show-completion
コマンドを実行して、シェルプロファイルに追加する必要のあるコマンド(.bashrc
、.bash_profile
、.zshrc
など)を生成します。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
コマンド出力テキストを選択してコピーします。
シェルのプロファイルファイル(この例では
.bashrc
)を開き、コピーしたテキストを貼り付けます。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
ファイルを保存します。
タブコンプリート機能を有効にするには、シェルを再起動するか、次のようにシェルプロファイルファイルに:codenowrap:
source
を使用します:source ~/.bashrc
この機能をテストするには、次のようにsnowコマンドの後に
TAB
を入力します。snow app [TAB]
deploy init open run teardown version