Create an application package

This topic describes how to create and manage an application package with the Snowflake Native App Framework.

About application packages

An application package is a container that encapsulates the data content, application logic, metadata, and setup script required by an application. An application package also contains information about versions and patch levels defined for the application.

Create an application package

The Snowflake Native App Framework supports creating an application package using Snowsight or alternatively you can create an application running SQL commands.

Privileges required to create an application package

To create an application package you must have the global CREATE APPLICATION PACKAGE privilege granted to your role.

Upload the manifest file and setup script to a named stage

Before creating an application package, you must create the manifest file and setup script and upload them to a named stage accessible to your account.

There are two ways to upload files to a named stage:

Create an application package using Snowsight

To create an application package using Snowsight, do the following:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » App Packages.

  3. Select Create » App Package.

  4. Enter a name for your application package.

  5. Select the intended consumer for the application package:

    • Select Consumers outside of your organization to make the application package available outside your organization. Selecting this option initiates an automated security scan for each version and patch defined in your application package.

    • Select Consumers within your organization to make the application package available within your organization. The automated security scan is not initiated.

  6. Optionally, enter comments for an application package. These comments are not visible to the consumer.

  7. Select Create.

Create an application package using SQL commands

To create an application package using SQL, use the CREATE APPLICATION PACKAGE command as shown in the following example:

CREATE APPLICATION PACKAGE HelloSnowflakePackage;
Copy

After creating an application package, use the SHOW APPLICATION PACKAGES command to view the list of available application packages.

Grant privileges on an application package

Some tasks related to developing an application package that you require have specific privileges set on the application package. The following table describes the privileges required to perform these tasks:

Privilege

Task

ATTACH LISTING

Add an application package to a listing.

DEVELOP

Create an APPLICATION object in development mode from the application package.

INSTALL

Create an APPLICATION object based on the application package.

MANAGE RELEASES

Specify a release directive, view the version and patch level.

MANAGE VERSIONS

Add a version and patch level to an application package.

OWNERSHIP

Perform all of the tasks above.

Grant privileges on an application package using Snowsight

To set the privileges on an application package using Snowsight, do the following:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » App Packages.

  3. Select the application package, then select the Settings tab.

  4. In the Privileges section, select the edit icon next to the privilege you want to grant.

  5. Select Add Role, then select the role to which you want to grant the privilege.

  6. Select Save.

The role appears next to the privilege.

Set privileges on an application package using SQL commands

To grant a privilege on the application package to a role using SQL, use the GRANT <privileges> command as shown in the following example:

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

This command grants the MANAGE RELEASES privilege to the app_release_mgr role. You can use the same command to grant the other privileges available on an application package.

Transfer ownership of an application package

After creating an application package, you can transfer ownership of the application package to another account-level role.

Transfer ownership using Snowsight

To transfer ownership of an application package using Snowsight, do the following:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » App Packages.

  3. Select next to the application package you want to transfer ownership, then select Transfer Ownership.

  4. Under Transfer to, select the new account-level role.

  5. Select Transfer.

Transfer ownership Using SQL Commands

To transfer ownership of an application package to a different account-level role using SQL, use the GRANT OWNERSHIP command as shown in the following example:

GRANT OWNERSHIP ON APPLICATION HelloSnowflakePackage TO ROLE native_app_dev;
Copy

Remove an application package from your account

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

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

Note

After removing a listing and the attached application package, the consumer can view but not access the Snowflake Native App created from the application package. If a consumer tries to access the Snowflake Native App, they receive an error indicating the application package has been removed.

Remove an application package using Snowsight

To remove an application package using Snowsight, do the following:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » App Packages.

  3. Select next to the application package you want to remove, then select Drop.

Remove an application package using SQL commands

To remove an application package using SQL, run the DROP APPLICATION PACKAGE command as shown in the following example:

DROP APPLICATION PACKAGE HelloSnowflakePackage;
Copy