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:

Privilege

Object

Notes

USAGE

Database where you create the Streamlit app

CREATE STREAMLIT,
USAGE

Schema where you create the Streamlit app

USAGE

Compute pool that runs the Streamlit app

For 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.

USAGE

Warehouse 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.

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Streamlit.

  3. Select + Streamlit App.

  4. Enter a name for your app.

  5. Select a database and schema to create your app in.

  6. Select Run on container.

  7. Select a compute pool and a query warehouse.

  8. Select Create.

Snowsight redirects you to the app editor. Your app will be ready within a few minutes. Then, you can view and edit it immediately.

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: