Getting started with Streamlit in Snowflake

This topic describes how to create and run your first Streamlit in Snowflake app.

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

Warehouse that runs queries in the Streamlit app

For warehouse-runtime apps, the warehouse also runs the app’s Python code.

USAGE

Compute pool that runs the Streamlit app

This privilege is only required if your app uses a container runtime (Preview).

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 app files. Snowflake automatically provides starter code when you create an app without specifying source files.

  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. Configure your app.

    To create a container-runtime app (Preview), select the following options:

    • Select Run on container.

    • Select a compute pool to run your app on. Preferrably, this should be a compute pool that is dedicated to running Streamlit apps.

    • Select a query warehouse to run your app’s queries on.

    To create a warehouse-runtime app, select the following options:

    • Select Run on warehouse.

    • Select a warehouse to run your app on. Preferrably, this should be a warehouse that is dedicated to running Streamlit apps.

  7. Select Create.

Snowflake creates a new Streamlit app with example code. Snowsight redirects you to the app editor. Your app will be ready within a few seconds to a few minutes, depending on the runtime type. Then, you can view and edit it immediately.

Edit your app

For more information about editing your app, see Editing a deployed Streamlit app.

After creating your app, you can edit the code to customize it:

  1. Sign in to Snowsight.

  2. In the navigation menu, select Projects » Streamlit, and then select your app.

  3. To open the editor, select Edit.

  4. In the editor pane, modify the code in the streamlit_app.py file.

  5. Select Run to see your changes.

What’s next?

Now that you’ve created your first app, explore these topics to learn more: