Creating 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.
Creating 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.
Uploading 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:
Using Snowsight. For details, refer to Staging Files Using Snowsight
Using the PUT command.
Creating an Application Package Using Snowsight¶
To create an application package using Snowsight, do the following:
Sign in to Snowsight.
In the left navigation bar, select Apps, then select Packages.
Select Create » App Package.
Enter a name for your application package.
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.
Optionally, enter comments for an application package. These comments are not visible to the consumer.
Select Create.
Creating 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;
After creating an application package, use the SHOW APPLICATION PACKAGES command to view the list of available application packages.
Granting 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. |
Granting Privileges on an Application Package Using Snowsight¶
To set the privileges on an application package using Snowsight, do the following:
Sign in to Snowsight.
In the left navigation bar, select Apps, then select Packages.
Select the application package, then select the Settings tab.
In the Privileges section, select the edit icon next to the privilege you want to grant.
Select Add Role, then select the role to which you want to grant the privilege.
Select Save.
The role appears next to the privilege.
Setting 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;
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.
Transferring Ownership of an Application Package¶
After creating an application package, you can transfer ownership of the application package to another account-level role.
Transferring Ownership Using Snowsight¶
To transfer ownership of an application package using Snowsight, do the following:
Sign in to Snowsight.
In the left navigation bar, select Apps, then select Packages.
Select … next to the application package you want to remove, then select Transfer Ownership.
Under Transfer to, select the new account-level role.
Select Transfer.
Transferring 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;
Removing 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.
Removing an Application Package Using Snowsight¶
To remove an application package using Snowsight, do the following:
Sign in to Snowsight.
In the left navigation bar, select Apps, then select Packages.
Select … next to the application package you want to remove, then select Drop.
Removing 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;