Getting started with Streamlit in Snowflake

This topic walks you through deploying your first Streamlit in Snowflake app in under five minutes using a container runtime. After that, two hands-on examples show you how to build real apps that query data, personalize the experience for each viewer, and write back to Snowflake.

Prerequisites

Before you can create a Streamlit app, ensure that your administrator has completed the essential security setup for Streamlit apps.

Your role must have the following privileges:

PrivilegeObjectNotes
USAGEDatabase where you create the Streamlit app
CREATE STREAMLIT, USAGESchema where you create the Streamlit app
USAGECompute pool that runs the Streamlit appFor all accounts, Snowflake configures a general-purpose compute pool that typical users will have access to. For more information, see Configuring your own preferred compute pools for Streamlit apps.
USAGEWarehouse that runs queries in the Streamlit app

For more information, see Privileges required to create and use a Streamlit app.

Deploy your first Streamlit in Snowflake app

The fastest way to get started is to create a Streamlit app using the default starter code. When you create an app without specifying source files, Snowflake provides example code automatically.

Note

In Snowsight, you can access Streamlit from two places:

  • Projects » Streamlit: Browse and open deployed apps that have been shared with you.
  • Workspaces: Create and edit apps. This is the recommended starting point for new apps.
  1. Sign in to Snowsight.
  2. In the navigation menu, select Workspaces, then open a workspace.
  3. Select + Add new » Streamlit app.

Snowflake creates a folder with starter files and opens the app editor. Select Run to preview the example app. Your app runs on a compute pool. No database or schema selection is needed at this step.

To deploy the app and share it with other users, see Create and run a Streamlit app in a workspace.

Edit your app

After deploying, you can edit the app code to customize it. For a quick test:

  1. Sign in to Snowsight.
  2. In the navigation menu, select Projects » Streamlit, and then select your app.
  3. Select Edit.
  4. Modify the code in streamlit_app.py.
  5. Select Run to see your changes.

For more information, see Edit your Streamlit app.

What’s next?

Now that you have a running app, try one of these hands-on examples:

To learn more about specific topics: