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¶
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.
Create an application package using Snowsight¶
Sign in to Snowsight.
In the navigation menu, select Projects » App Packages.
Select Create and then click App Package in the right pane.
Enter a name for your application package.
Select the intended consumer for the application package:
Select Distribute to accounts 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 Distribute to accounts in your organization to make the application package available within your organization. The automated security scan is not initiated.
(Optional) Enter comments for the application package. These comments are not visible to the consumer.
Select Add.
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;
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¶
Sign in to Snowsight.
In the navigation menu, select Projects » App 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.
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 hello_snowflake_package 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.
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¶
Sign in to Snowsight.
In the navigation menu, select Projects » App Packages.
Select … next to the application package you want to transfer ownership, then select Transfer Ownership.
Under Transfer to, select the new account-level role.
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 PACKAGE hello_snowflake_package TO ROLE native_app_dev;
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¶
Sign in to Snowsight.
In the navigation menu, select Projects » App Packages.
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 hello_snowflake_package;