Test and PublishYour Snowflake Native App

Learn how to test and publish (private and public) your Native Application

Following my blog on how to develop a simple Snowflake Native App, I’ve received numerous requests for more information on how to share the app with consumers. In this post, I’ll explain the process.

Preparing your app for listing

After deploying your app (read more in my previous blog), log in as an ACCOUNT_ADMIN (or with sufficient permissions) and navigate to ‘Data Products’ => Apps

Verify that your app is installed

If you didn’t set the default version, do it now.
(If you fail to set it, you will get an error message while trying to share your application: “This application package does not have a default version patch. Please set the default before publishing.”)

You can check if if there is a version by running:

SHOW APPLICATIONS;
SHOW VERSIONS IN APPLICATION PACKAGE INFOSTRUX_XXX;

If you recall you specified the version in the manifest.yaml file.
However, the label and comment are not going to affect the app’s version, so it is only for your traceability.

manifest_version: 1 # required
version:
name: hello_snowflake
label: "v1_0"
comment: "The first version of a Snowflake Native App"

If you would like to add a new version, you can do it from the Snow cli or SQL query

If you don’t have Snow cli yet, you can install it from https://github.com/snowflakedb/snowflake-cli

snow app version create V1_0 --connection="dev"
snow app version list --connection dev

Alternatively, you can create a Version from a Snowflake worksheet by the following SQL

-- You can get the application name and package name (source) 
-- by using the following command
SHOW APPLICATIONS;

-- Create a version
ALTER APPLICATION PACKAGE INFOSTRUX_DATA_MATURITY_PKG
ADD VERSION V1_0
USING '@INFOSTRUX_DATA_MATURITY_PKG.APP_SRC.STAGE';
-- USING '@PKG_NAME.CODESCHEMA.AppCodeStage';

SHOW VERSIONS IN APPLICATION PACKAGE INFOSTRUX_DATA_MATURITY_PKG;

Note: Your package name might contain your computer username. This name is helpful in case a few developers are working on the development, and it will not be shared with the consumers.

Security test for your application

Your app would need to get approved by the automatic security tests

-- Security test
ALTER APPLICATION PACKAGE INFOSTRUX_DATA_MATURITY_PKG
SET DISTRIBUTION = EXTERNAL;

-- Check the review status in the review_status column
SHOW VERSIONS IN APPLICATION PACKAGE INFOSTRUX_DATA_MATURITY_PKG;

-- Once it has APPROVED status you can set the default to this version

-- Set default version
ALTER APPLICATION PACKAGE INFOSTRUX_DATA_MATURITY_PKG
SET DEFAULT RELEASE DIRECTIVE
VERSION = V1_0
patch = 0
;

If there are new issues, you should get APPROVED status.

Private Listing

Before publicly sharing your app, consider sharing it with a selected account, such as another Snowflake account within your company or a friend who can test it and provide feedback.

Now navigate to Provider Studio

Let’s Publish to specified consumers only.
Click the ‘create a listing’.

Make sure ‘Only Specified Consumers’ is selected, add your listing title and click Next

Add your package, brief description and the consumer accounts

Ask your consumer to copy their account identifier from the bottom left of the Snowflake web UI and share with you. It would be <organization>.<locator>

Click more and add your email to get a notification.

Press publish and login to the Consumer account

In the Consumer account you will be able to see the app that you just shared

Click the ‘Get’ button

Select a warehouse for the installation process and click the ‘Get’ button

This will install the application

If you added an email while publishing your app, the recipient should also get an email notification that they can now use the new application.

Clicking the ‘Open’ button will run your application in the consumer account.

The Provider can see that the application is live

Publicly share your app

Before publicly releasing your app, it’s essential to review Snowflake’s Marketplace Profile & Listing Template. This will help you prepare the necessary categories and descriptive text that will assist consumers in finding and comprehending the purpose of your application.
https://www.snowflake.com/wp-content/uploads/2021/12/SDM-Provider-Profile-Listing-Template.pdf

After submitting your app for public sharing, you should receive an email from the Snowflake testing team titled “Functional Review: Infostrux Data Maturity.” In this email, you will be requested to share your app with the testing team privately. They will then run your app and conduct a thorough review. Note down the Snowflake’s account name that is specified in this email.

To do it, navigate to ‘Data Products’ -> Provider Studio -> Only Specified Consumers, and on the next page, specify the Snowflake account you received by email.

Once published, you should see that your app is live for the specific account you shared it with.

Public sharing

This time, Create a Listing with ‘Anyone on the Marketplace’
I recommend you create a Word document with all your listing properties in advance so you can check your English, share it with others to review, and have a backup in case something goes wrong while listing.

The template and instructions can be found in Snowflake documentation.

Start with adding the Basic Information

You will need to provide a title and subtitle and choose your profile.

Category

This might be a bit tricky since not all categories are covered. Try to find the best fit for your app.

Details

Description: Strive to provide a comprehensive description detailing how your product benefits the customer and its functionalities.
The description should include three sections: 1) Intro paragraph, 2) Sample tables, 3) Sample fields. Refer to the Marketplace Profile & Listing Template for detailed requirements.

Link to Documentation: Provide a link to the product information. You are not permitted to provide a link solely to your website homepage. If necessary, create a GitHub repository specifically for the README file of your product.

Add ‘Data Product’ by choosing your package

If there is an error, you missed setting the default version of the package. Look again at the beginning of this post.

For data attributes, pay attention to the fact that you will need to choose N/A if you don’t have one.

Add a business need

If you don’t find a good fit, choose the ‘Custom’ and add a new one.

Add a region availability

It might be good to start with one region, collect feedback, and publish to all Regions.

The review button should now be enabled. Preview everything once again and publish.

The Snowflake team will review your app and get back to you in a few days.

In case the app is denied you will get an email with the reasons for the denial. You can also login to your Snowflake account -> Provider Studio and see the details.

Reasons, for example, can be the following

Setting a new version or patch

You can use the snowcli to manage the versions

If you want to add a patch to version V1 using the auto-increment functionality, use the following command:

snow app version create V1_0 --connection="dev"

This time, you will see that a Patch was created

Note that the labels and comments did not change

If the application is External, there will run an immediate security test

You will still need to set the default to the new patch

-- Set the default version to the patch
ALTER APPLICATION PACKAGE INFOSTRUX_DATA_MATURITY_PKG_NOAMSTEINER
SET DEFAULT RELEASE DIRECTIVE
VERSION = V1_0
patch = 1
;

Re-submit

After implementing the feedback and addressing the issues, you can resubmit the application listing directly from the UI.
Navigate to the Provider Studio->Listing->Click on the denied app->Under ‘Data Products’ click on the application package name->Verify the version and patch number and click the ‘Release Patch’.
Then, navigate to the app's main page and re-submit the app.

The application will be pending until the review by the Snowflake team is done.

Once your fixes are approved, your listing will go live if it is set for Auto Publish.

You will be able to navigate to the Analytics pane to get your app's statistics.

Tips

  • Your application must deliver genuine value to your customers. If it fails to do so, it’s unlikely to be approved.
  • Don’t include a link to your website or offline content in your application.
  • While listing your application, give a detailed description.
  • Prepare offline documentation for your application in a git repository.
  • In case your application displays code, use the following:
# For code in Streamlits: Streamlit includes a st.code component 
# that can be used to format content into a code block:
code = '''def hello():
print("Hello, Streamlit!")'''
st.code(code, language='python')
  • Use try-catch in your code to show the user a readable message with what they need to do.
  • If your application uses Streamlit, request the grants with a Streamlit popup using the permissions and references. The following example asks for account-level permissions. You can remove or add this permission later by navigating to Apps-> click the … right to your app -> View details -> Click on the pencil to edit a grant you would like to update
    if not permissions.get_held_account_privileges(["IMPORTED PRIVILEGES ON SNOWFLAKE DB"]):
permissions.request_account_privileges(["IMPORTED PRIVILEGES ON SNOWFLAKE DB"])

Summary

In this blog post, we walk through how to set up security tests for your Snowflake native app and privately share it with another account for testing before publishing it publicly.

To stay updated on more Snowflake-related posts, follow me at my Medium profile: Eylon’s Snowflake Articles.

I’m Eylon Steiner, Engineering Manager for Infostrux Solutions. You can follow me on LinkedIn.

Subscribe to Infostrux Medium Blog at https://blog.infostrux.com for the most interesting Data Engineering and Snowflake news. Follow Infostrux’s open-source efforts through GitHub.

--

--