Create and manage an application package

This topic describes how providers can create an application package to develop a Snowflake Native App.

About the application package

An application package is a container that encapsulates the data content and application logic used by a Snowflake Native App. An application package also contains information about versions and patches defined for an app.

Each version of an app requires its own version of the manifest and setup script:

manifest file:

The manifest file contains information that the application package requires to create and manage a Snowflake Native App. This includes the location of the setup script, version definitions, and configuration information for the app.

For more information, see アプリのマニフェストファイルの作成.

setup script:

The setup script contains SQL statements that are run when the app is installed, either in the consumer account or locally during development and testing.

For more information, see Create the setup script.

注釈

You can create an application package without creating the manifest file or setup script. However, to develop or test an app, you must upload these files to a stage so they are accessible to the application package.

About release channels

Release channels manage the release lifecycle of Snowflake Native Apps. They allow providers to create and manage versions of an app and to publish the app at different stages of development to all consumers or specific groups of consumers.

注意

When you create an application package, release channels are enabled by default. After release channels have been enabled for an application package, they can't be disabled.

For more information on using release channels to manage the release lifecycle of an app, see リリースチャネルを使用してアプリを公開する.

To use the previous process for managing versions and patches you must explicitly disable release channels when creating the application package. However, for new app development Snowflake recommends using release channels to manage the release lifecycle of your apps.

For information on using the older features for managing versions and patches, see Develop a new version of an app (Legacy).

アプリケーションパッケージの作成に必要な権限

アプリケーションパッケージを作成するには、使用するロールにグローバル権限(CREATE APPLICATION PACKAGE)が付与されている必要があります。

アプリケーションパッケージを作成する

You can create an application package using one of the following methods:

Create an application package using Snowsight

  1. Snowsight にサインインします。

  2. ナビゲーションメニューで Projects » App packages を選択します。

  3. Create を選択し、右ペインの App Package をクリックします。

  4. アプリケーションパッケージの名前を入力します。

  5. アプリケーションパッケージの対象コンシューマーを選択します。

    • Distribute to accounts outside of your organization を選択すると、アプリケーションパッケージを組織外で利用できるようになります。このオプションを選択すると、アプリケーションパッケージで定義されている各バージョンとパッチについて、 自動セキュリティスキャン が開始されます。

    • Distribute to accounts in your organization を選択して、組織内でアプリケーションパッケージを利用できるようにします。自動セキュリティスキャンは開始されません。

  6. (オプション)申請パッケージに対するコメントを入力します。これらのコメントはコンシューマーには表示されません。

  7. Add を選択します。

SQL コマンドを使用してアプリケーションパッケージを作成する

SQL を使用してアプリケーションパッケージを作成するには、次の例に示すように CREATE APPLICATION PACKAGE コマンドを使用します。

CREATE APPLICATION PACKAGE my_application_package;
Copy

This command creates an application package named my_application_package in your Snowflake account. By default, release channels are enabled for the application package.

アプリケーションパッケージを作成したら、 SHOW APPLICATION PACKAGES コマンドを使用して、利用可能なアプリケーションパッケージのリストを表示します。

Create an application package using the Snowflake CLI

If you are using the Snowflake CLI to develop an app, the application package is created when you run the snow app run command. This command creates an application package in your Snowflake account, uploads code files to a stage, then creates or upgrades an app from the application package.

Grant the required privileges on an application package

Some tasks related to creating or using an application package require specific privileges on the application package. The following table describes the privileges required to perform these tasks:

権限

タスク

ATTACH LISTING

リストにアプリケーションパッケージを追加します。

DEVELOP

アプリケーションパッケージから開発モードで APPLICATION オブジェクトを作成します。

INSTALL

アプリケーションパッケージに基づいて APPLICATION オブジェクトを作成します。

MANAGE RELEASES

リリースディレクティブを指定し、バージョンとパッチレベルを表示します。

MANAGE VERSIONS

アプリケーションパッケージにバージョンとパッチレベルを追加します。

OWNERSHIP

上記のすべての作業を実行します。

Grant privileges on an application package using Snowsight

  1. Snowsight にサインインします。

  2. ナビゲーションメニューで Projects » App packages を選択します。

  3. アプリケーションパッケージを選択し、 Settings タブを選択します。

  4. Privileges セクションで、付与する権限の横にある編集アイコンを選択します。

  5. Add Role を選択し、権限を付与するロールを選択します。

  6. Save を選択します。

権限の隣にロールが表示されます。

SQL コマンドを使用したアプリケーションパッケージの権限付与

SQL を使用してアプリケーションパッケージに対する権限をロールに付与するには、次の例に示すように、 GRANT <権限> ... TO ROLE コマンドを使用します。

GRANT MANAGE RELEASES ON APPLICATION PACKAGE hello_snowflake_package TO ROLE app_release_mgr;
Copy

このコマンドは、 app_release_mgr ロールに MANAGE RELEASES 権限を付与します同じコマンドを使用して、アプリケーションパッケージに対して利用可能なその他の権限を付与することができます。

アプリケーションパッケージのデフォルトリリースディレクティブを設定する

A release directive determines the version and patch of an app that is available to a consumer when they install the app or when an installed app is automatically upgraded. For information on setting the release directive, see Set the release directive for an app (Legacy)

コンシューマーがアプリの複数のインスタンスをインストールできるようにする

プロバイダーは、コンシューマーがアプリケーションの複数のインスタンスをインストールできるように、アプリケーションパッケージを構成できます。

アプリの複数のインスタンスを有効にするには、 CREATE APPLICATION PACKAGE または ALTER APPLICATION PACKAGE コマンドの MULTIPLE_INSTANCES = TRUE 句を使用します。

アプリに複数のインスタンスが許可されている場合、コンシューマーは自分のアカウントに最大10インスタンスのアプリをインストールできます。

トライアルまたは有料リストに含まれるアプリケーションパッケージには、このプロパティをセットできません。

注意

MULTIPLE_INSTANCES プロパティを TRUE に設定した後、それを解除したり FALSE に設定したりすることはできません。

アプリケーションパッケージの所有権を譲渡する

アプリケーションパッケージを作成した後、アプリケーションパッケージの所有権を別のアカウントレベルのロールに譲渡することができます。

Snowsight を使用して所有権を譲渡する

  1. Snowsight にサインインします。

  2. ナビゲーションメニューで Projects » App packages を選択します。

  3. 所有権を譲渡するアプリケーションパッケージの横にある ... を選択し、 Transfer Ownership を選択します。

  4. Transfer to で、新しいアカウントレベルのロールを選択します。

  5. Transfer を選択します。

SQL コマンドを使用して所有権を譲渡する

SQL を使用して、アプリケーションパッケージの所有権を別のアカウントレベルのロールに譲渡するには、次の例に示すように、 GRANT OWNERSHIP コマンドを使用します。

GRANT OWNERSHIP ON APPLICATION PACKAGE hello_snowflake_package TO ROLE native_app_dev;
Copy

アプリケーションパッケージを削除する

Providers with the OWNERSHIP privilege on an application package can remove it from an account. However, providers cannot remove an application package that is currently associated with a listing.

After removing an application package, it is no longer available in the provider account.

注意

リストと添付されたアプリケーションパッケージを削除した後、コンシューマーはアプリケーションパッケージから作成された Snowflake Native App を表示することはできますが、アクセスすることはできません。コンシューマーが Snowflake Native App にアクセスしようとすると、アプリケーションパッケージが削除されたことを示すエラーを受け取ります。

Delete an application package using Snowsight

  1. Snowsight にサインインします。

  2. ナビゲーションメニューで Projects » App packages を選択します。

  3. 削除するアプリケーションパッケージの横にある ... を選択し、 Drop を選択します。

Delete an application package using SQL commands

SQL を使用してアプリケーションパッケージを削除するには、次の例に示すように、 DROP APPLICATION PACKAGE コマンドを実行します。

DROP APPLICATION PACKAGE hello_snowflake_package;
Copy