Streamlitアプリのデプロイ¶
snow streamlit deploy コマンドは、選択したデータベースとスキーマの中に新しいStreamlitオブジェクトを作成します。デフォルトでは、このコマンドは現在の作業ディレクトリにある streamlit_app.py というメインファイルを探します。
前提条件¶
Snowflake CLI を使用してStreamlitアプリをデプロイする前に、以下の前提条件を満たす必要があります。
ローカルに正しいディレクトリ構造のStreamlitアプリがあること、および
snowflake.ymlプロジェクト定義ファイルが存在することを確認してください。Ensure that your account has the correct privileges as described in Privileges required to create and use a Streamlit app.
Streamlitアプリのファイルをアップロードする名前付きステージを作成できるか、そのアクセス権があることを確認する。
Streamlitアプリをデプロイする方法¶
注釈
With the release of Snowflake CLI 3.14.0, the snow streamlit deploy command now uses the updated CREATE STREAMLIT syntax (FROM source_location) instead of the deprecated syntax (ROOT_LOCATION = '<stage_path_and_root_directory>'). To continue using the deprecated syntax, you can use the --legacy option.
snow streamlit deploy コマンドは、ローカルファイルをステージにアップロードし、選択したデータベースとスキーマ内に新しいStreamlitオブジェクトを作成します。 プロジェクト定義ファイル には、メインのPythonファイルとクエリウェアハウスを指定します。また、以下のオプションを指定することもできます。
--replace: 指定されたStreamlitアプリが既に存在する場合は置き換えます。--open: アプリのデプロイ後、デフォルトのブラウザーでStreamlitアプリを開きます。--prune: ステージに存在するファイルは削除しますが、ローカルファイルシステム内のファイルは削除しません(デフォルトでは削除されません)。--legacy: Uses the deprecated SQLsyntax (ROOT_LOCATION = '<stage_path_and_root_directory>').
By default the command automatically deploys the environment.yml file and the content of the pages/
directory, if any of those exists. You can use different files by using command-line options.
Streamlitアプリの作成については、 CLI snow streamlit deploy および SQL CREATE STREAMLIT コマンドをご参照ください。