Paquets d’application dans le partage déclaratif du framework des applications natives¶
As a provider, you create an application package to bundle your data content and notebooks into a Declarative Native App. This topic explains what an app package is and describes the high-level steps to create one, from creating the initial package to adding your manifest and notebook files.
The application package and the live version¶
The app package is a container for all the files that make up the app, including the manifest file and any Snowflake Notebooks. When you create an app package, a live (staged) version of the app package is also created. The live version is a development workspace where you can add or update files, such as the manifest file and notebook files, and preview and test the experience before publishing.
Once you’re satisfied with the live version of the app, you can commit the live version to create a new immutable version of the app package, that you can then publish.
Using the live version for development simplifies version management by maintaining a single immutable version of the app package that is ready to be published, and a single live version for development. The Snowflake Native App Framework automatically manages the versioning of the app package, so you don’t need to manually track version numbers.
The Snowflake Native App Framework maintains a live version for any app package automatically. Even if you remove the live version, a new live version is created automatically from the last committed version of the app package.
Création d’un paquet d’application¶
Providers develop and test an application (app) package. An app package includes files necessary to share the data in the app, and defines how data can be accessed by consumers.
Ce processus comprend les étapes suivantes :
Create an app package project (first time only): creates an app package project that will later be published. This also creates the live version of the app package.
Add content to the app package:
Create or update a manifest file: This file describes the app package and its contents.
Download notebook files. If notebooks are to be included, download a copy to be included in the app package.
Add the files to the live version of the app package.
Build the app package: allows you to verify that the manifest file is valid and that all links in the manifest file are correct.
Test the app. Install the app and try it out. Make changes, and rebuild.
Commit the app package: creates a new immutable version of the app that can be published.
Release the app package. With a released package, you can create a new listing, either privately or publicly on the Snowflake Marketplace.
Ce processus est décrit dans Tutoriel : Premiers pas avec Declarative Native Apps. Cette section inclut des détails supplémentaires sur les options disponibles aux différentes étapes du développement.
Créer un nouveau paquet d’application¶
First, create a new Declarative Native App package to hold the app’s files, either via Snowsight or SQL commands from Snowflake CLI, using the snow://package/<DECL_SHARE_APP_PKG>/versions/LIVE/ URL scheme.
Pour utiliser l’Snowsight pour créer un nouveau paquet d’application, procédez comme suit :
Sign in to Snowsight.
In the navigation menu, select Projects » App Packages.
Dans la carte Share Data + Code, sélectionnez Create.
Saisissez un nom pour votre paquet d’application, puis sélectionnez Create.
Pour utiliser SQL dans Snowflake CLI pour créer un nouveau paquet d’application, procédez comme suit :
Create a Declarative Native App package using the CREATE APPLICATION PACKAGE … TYPE=DATA command, replacing
<DECL_SHARE_APP_PKG>with the name you want to give the app package:
snow sql -q "CREATE APPLICATION PACKAGE <DECL_SHARE_APP_PKG> TYPE = DATA;"
The new empty app package is created. This also creates a live version of the app package that you can edit.
Assemble content for the application package¶
An app package includes the following components:
A manifest file (required): A text-based file that defines the app’s structure.
Snowflake Notebook files (optional): One or more text-based files that can act as a front end to the consumer experience, referencing the shared views and tables. They can also include code, reference visualizations, and include logic to help present the data.
Créer ou mettre à jour un fichier manifeste¶
You can create or update a manifest file, which describes the app package and its shared content–for example, notebooks, tables, and views. It defines other metadata, such as app roles included with the app.
The manifest file must be named manifest.yml, and must be added to the root level of the app package.
Pour plus d’informations, voir Référence du manifeste d’une Declarative Native App. Le Tutoriel : Premiers pas avec Declarative Native Apps asssocié comprend un exemple de fichier manifeste.
Obtenir des fichiers notebook¶
If Snowflake Notebooks are to be included in the app, download a copy of each notebook file so you can include it in the app package.
Depuis Snowsight :
Dans le menu de navigation, sélectionnez. Projects » Notebooks, puis sélectionnez le notebook que vous souhaitez télécharger.
In the left pane, next to your notebook, select … » Download.
Le fichier est téléchargé sur votre machine locale, sous la forme d’un fichier nommé <notebook_name>.ipynb.
Note
L’environnement du notebook dispose d’un ensemble de packages Anaconda préinstallés, dont Python et Streamlit. Si votre notebook utilise des packages Anaconda supplémentaires, vous devez les ajouter en tant que packages à votre notebook afin qu’ils puissent être utilisés dans l’environnement du consommateur. Pour obtenir des informations sur la manière d’ajouter des packages Anaconda à votre notebook, consultez Add Anaconda packages to a notebook.
Add files to the live version¶
Add the manifest and notebook files to the live version of the app package:
Pour utiliser l’Snowsight pour alimenter le paquet d’application, procédez comme suit :
If you’re not already viewing the app package’s listing, from the navigation menu, select Projects » App Packages, and then select the app package you want to add files to.
Sélectionnez Upload files. (Si vous voulez remplacer ou ajouter des fichiers supplémentaires, sélectionnez Manage files, puis sélectionnez Upload files.)
Faites glisser les fichiers notebook et le fichier manifeste depuis votre disque dur vers la boîte de dialogue Upload files à l’endroit indiqué, ou sélectionnez Browse pour localiser et sélectionner les fichiers.
Sélectionnez Upload pour télécharger les fichiers vers la zone de préparation active et déclencher une version.
Pour utiliser SQL dans Snowflake CLI afin d’alimenter le paquet d’application, utilisez les commandes suivantes, en remplaçant les chemins d’accès aux fichiers par vos propres chemins d’accès, ainsi que
<DECL_SHARE_APP_PKG>par le nom du paquet d’application :Fichier manifeste :
snow sql -q "PUT file:////Users/test_user/Documents/manifest.yml snow://package/<DECL_SHARE_APP_PKG>/versions/LIVE/ OVERWRITE=TRUE AUTO_COMPRESS=false;"
Notebook file:
snow sql -q "PUT file:////Users/test_user/Documents/NOTEBOOK.ipynb snow://package/<DECL_SHARE_APP_PKG>/versions/LIVE/ OVERWRITE=TRUE AUTO_COMPRESS=false;"
Verify the files are in the application package with the following command:
snow sql -q "LIST snow://package/<DECL_SHARE_APP_PKG>/versions/LIVE"
La sortie affiche les fichiers dans la version active du paquet d’application, comme suit :
+--------------------------------------------------------------------------------+ | name | size | md5 | last_modified | |-------------------------------+------+---------+-------------------------------| | /versions/live/manifest.yml | 304 | 843a... | Wed, 23 Jul 2025 08:27:26 GMT | | /versions/live/NOTEBOOK.ipynb | 832 | b014... | Wed, 23 Jul 2025 04:32:22 GMT | +--------------------------------------------------------------------------------+
Download a file from the application package¶
Vous pouvez télécharger un fichier à partir du paquet d’application en utilisant la commande SQL GET dans Snowflake CLI :
now sql -q "GET snow://package/<package_name>/versions/LIVE/manifest.yml file://manifest.yml"
Remove content from the application package¶
You can remove files from the application package.
Using Snowsight:
If you’re not already viewing the app package’s listing, from the navigation menu, select Projects » App Packages, and then select the app package you want to remove files from.
Sélectionnez Manage files » Remove files.
Sélectionnez le(s) fichier(s) que vous souhaitez supprimer, puis sélectionnez Delete.
Dans la boîte de dialogue Remove files, choisissez les fichiers à supprimer, puis sélectionnez Remove & build.
Utilisation de la commande SQL REMOVE (ou RM) dans Snowflake CLI :
snow sql -q "RM snow://package/<DECL_SHARE_APP_PKG>/versions/LIVE/manifest.yml"
Tester le paquet d’application¶
Ensuite, créez une version testable de l’application.
In Snowsight:
Lorsque vous chargez un ensemble complet de fichiers vers le paquet d’application, une version démarre automatiquement.
Pour créer une version à tout autre moment, cliquez sur le bouton Créer sur la page du paquet d’application.
If there are any errors in the manifest file, the build fails and gives information on how to fix the error. Correct the errors and rebuild the app package.
La commande ALTER APPLICATION PACKAGE … BUILD crée une version testable du paquet d’application, puis vérifie que le fichier manifeste est valide et que tous les liens fonctionnent.
ALTER APPLICATION PACKAGE <DECL_SHARE_APP_PKG> BUILD;
If there are any errors in the manifest file, the build fails and gives information on how to fix the error. Correct those errors and rebuild the app package.
L’application créée reste en état actif et vous pouvez continuer à apporter des modifications au paquet d’application.
À ignorer !¶
For updates that don’t require further testing, you can skip ahead by building, committing, and releasing an app package all at once using the ALTER APPLICATION PACKAGE … RELEASE LIVE VERSION command.
ALTER APPLICATION PACKAGE <DECL_SHARE_APP_PKG> RELEASE LIVE VERSION;
Tester l’application¶
After building the app package, you can perform basic tests on it from the live environment.
Install the app from an app package using the command: CREATE APPLICATION … FROM APPLICATION PACKAGE, replacing <DECL_SHARE_APP> with the name of the app. For example:
CREATE APPLICATION <DECL_SHARE_APP> FROM APPLICATION PACKAGE <DECL_SHARE_APP_PKG>
Update the files in the app package as needed, and then see if it worked by using the command: ALTER APPLICATION PACKAGE … UPGRADE USING VERSION LIVE.
ALTER APPLICATION PACKAGE <DECL_SHARE_APP_PKG> UPGRADE USING VERSION LIVE;
To test some features, such as app roles, you must first release a new version of the app package, and then test using a separate consumer account. For more information, see Installer une Declarative Native App and Accéder au contenu d’une Declarative Native App.
En option : Réinitialiser les modifications sur une version active¶
If the edits made to the live version of the app package are no longer needed, you can reset the app package to the state before the edits were made with the ALTER APPLICATION PACKAGE … ABORT LIVE VERSION command.
ALTER APPLICATION PACKAGE <DECL_SHARE_APP_PKG> ABORT LIVE VERSION;
When you use the preceding command to remove the current live version, a new live version is created with the same contents as the last committed version of the app package. The live version is reset to the last committed version, and all changes made to the live version are discarded.
Commit and release the application package¶
Committing the app package builds a new immutable version of the app that can’t be edited and is ready to be published. Releasing the app package does the following:
Crée une application validée prête à être partagée avec des consommateurs.
Si le fournisseur a déjà partagé l’application avec des consommateurs, la nouvelle version est automatiquement disponible pour ces consommateurs.
If there’s already a live version of the app on the Snowflake Marketplace, the new version is automatically available to consumers who have installed the app.
Pour utiliser l’Snowsight pour valider et publier le paquet d’application, procédez comme suit :
If you’re not already viewing the app package’s listing, from the navigation menu, select Projects » App Packages, and then select the app package you want to release.
Sélectionnez Commit & release.
Dans la boîte de dialogue de confirmation, sélectionnez Acknowledge & continue.
The committed app package is released, and the live version of the app package is removed. A new live version of the app package is created from the new committed version for further development.
Une fois que vous avez validé et publié le paquet d’application, l’onglet Latest release affiche le contenu de la version, qui est identique à celui de la dernière version.
In SQL, use the ALTER APPLICATION PACKAGE commands as shown:
ALTER APPLICATION PACKAGE <DECL_SHARE_APP_PKG> COMMIT;
The live version of the app package is removed. A new live version of the app package is created from the new committed version for further development.
Next, release the committed app package:
ALTER APPLICATION PACKAGE <DECL_SHARE_APP_PKG> RELEASE;
You can also build, commit, and release a live version of the app package, all at once:
ALTER APPLICATION PACKAGE <DECL_SHARE_APP_PKG> RELEASE LIVE VERSION;
After you release the app package, you can create a new listing for the app, either privately or publicly on the Snowflake Marketplace. For more information, see Création d’une annonce à l’aide du partage déclaratif.