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 Créer le fichier manifeste pour une application.

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.

Note

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.

Prudence

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 Publier une application à l’aide des canaux de version.

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).

Privilèges requis pour créer un paquet d’application

Pour créer un paquet d’application, vous devez disposer du privilège global CREATE APPLICATION PACKAGE accordé à votre rôle.

Création d’un paquet d’application

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

Create an application package using Snowsight

  1. Connectez-vous à Snowsight.

  2. Dans le menu de navigation, sélectionnez Projects » App packages.

  3. Sélectionnez Create et puis cliquez sur App Package dans le volet de droite.

  4. Saisissez un nom pour votre paquet d’application.

  5. Sélectionnez le consommateur pour qui le paquet d’application est prévu :

    • Sélectionnez Distribute to accounts outside of your organization pour que le paquet d’application soit disponible en dehors de votre organisation. La sélection de cette option déclenche une analyse de sécurité automatisée pour chaque version et chaque correctif définis dans votre paquet d’application.

    • Sélectionnez Distribute to accounts in your organization pour mettre le paquet d’application à la disposition de votre organisation. L’analyse de sécurité automatisée n’est pas lancée.

  6. (Facultatif) Saisissez des commentaires sur le paquet d’application. Ces commentaires ne sont pas visibles pour le consommateur.

  7. Sélectionnez Add.

Création d’un paquet d’application à l’aide de commandes SQL

Pour créer un paquet d’application avec SQL, utilisez la commande CREATE APPLICATION PACKAGE comme indiqué dans l’exemple suivant :

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.

Après avoir créé un paquet d’application, utilisez la commande SHOW APPLICATION PACKAGES pour voir la liste des paquets d’applications disponibles.

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:

Privilège

Tâche

ATTACH LISTING

Ajouter un paquet d’application à une annonce.

DEVELOP

Créer une objet APPLICATION en mode développement à partir du paquet d’application.

INSTALL

Créer un objet APPLICATION basé sur le paquet d’application.

MANAGE RELEASES

Spécifier une directive de version, voir la version et le niveau de correctif.

MANAGE VERSIONS

Ajouter une version et un niveau de correctif à un paquet d’application.

OWNERSHIP

Effectuer toutes les tâches ci-dessus.

Grant privileges on an application package using Snowsight

  1. Connectez-vous à Snowsight.

  2. Dans le menu de navigation, sélectionnez Projects » App packages.

  3. Sélectionnez le paquet d’application, puis l’onglet Settings.

  4. Dans la section Privileges sélectionnez l’icône de modification en regard du privilège que vous souhaitez accorder.

  5. Sélectionnez Add Role, puis le rôle auquel vous souhaitez accorder le privilège.

  6. Sélectionnez Save.

Le rôle apparaît à côté du privilège.

Accorder des privilèges sur un paquet d’application à l’aide de commandes SQL

Pour attribuer un privilège sur le paquet d’application à un rôle à l’aide de SQL, utilisez la commande GRANT <privilèges> … TO ROLE comme indiqué dans l’exemple suivant :

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

La commande attribue le privilège MANAGE RELEASES au rôle app_release_mgr. Vous pouvez utiliser la même commande pour accorder les autres privilèges disponibles sur un paquet d’application.

Définir la directive de version par défaut d’un paquet d’application

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)

Permettre aux consommateurs d’installer plusieurs instances d’une application

Les fournisseurs peuvent configurer un paquet d’application pour permettre aux consommateurs d’installer plusieurs instances d’une application.

Pour activer plusieurs instances d’une application, utilisez la clause MULTIPLE_INSTANCES = TRUE des commandes CREATE APPLICATION PACKAGE ou ALTER APPLICATION PACKAGE.

Si plusieurs instances sont autorisées pour une application, les consommateurs peuvent installer un maximum de 10 instances de l’application dans leur compte.

Vous ne pouvez pas définir cette propriété pour un paquet d’application inclus dans un listing d’essai ou payant.

Prudence

Une fois que la propriété MULTIPLE_INSTANCES a été définie sur TRUE, elle ne peut être ni annulée ni définie sur FALSE.

Transfert de propriété d’un paquet d’application

Après avoir créé un paquet d’application, vous pouvez en transférer la propriété à un autre rôle de niveau compte.

Transfert de propriété à l’aide de Snowsight

  1. Connectez-vous à Snowsight.

  2. Dans le menu de navigation, sélectionnez Projects » App packages.

  3. Sélectionnez à côté du paquet d’application que vous souhaitez supprimer, puis sélectionnez Transfer Ownership.

  4. Sous Transfer to, sélectionnez le nouveau rôle au niveau du compte.

  5. Sélectionnez Transfer.

Transfert de propriété à l’aide de commandes SQL

Pour transférer la propriété d’un paquet d’application à un autre rôle au niveau du compte à l’aide de SQL, utilisez la commande GRANT OWNERSHIP comme indiqué dans l’exemple suivant :

GRANT OWNERSHIP ON APPLICATION PACKAGE hello_snowflake_package TO ROLE native_app_dev;
Copy

Supprimer un paquet d’application

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.

Prudence

Après avoir supprimé une annonce et le paquet d’application qui y était associé, le consommateur peut voir l”Snowflake Native App créée à partir du paquet d’application, mais il n’y a pas accès. Si un consommateur tente d’accéder à l”Snowflake Native App, il reçoit une erreur indiquant que le paquet d’applications a été supprimé.

Delete an application package using Snowsight

  1. Connectez-vous à Snowsight.

  2. Dans le menu de navigation, sélectionnez Projects » App packages.

  3. Sélectionnez à côté du paquet d’application que vous souhaitez supprimer, puis sélectionnez Drop.

Delete an application package using SQL commands

Pour supprimer un paquet d’application à l’aide de SQL, exécutez la commande DROP APPLICATION PACKAGE comme indiqué dans l’exemple suivant :

DROP APPLICATION PACKAGE hello_snowflake_package;
Copy