> ## Documentation Index
> Fetch the complete documentation index at: https://docs.curator.interworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Snowflake Streamlit App

> Show a Streamlit in Snowflake app on a Curator page, running in Snowflake as the signed-in viewer.

The **Snowflake Streamlit App** page element shows a Streamlit in Snowflake app inside a Curator page. The app runs
in Snowflake as the viewer who is signed in to Curator, under the role of the portal's Snowflake connection. The
viewer never signs in to Snowflake, and the app's queries, `CURRENT_USER()` and row access policies all see that
viewer's own Snowflake user.

## Prerequisites

* An active [Snowflake connection](https://docs.curator.interworks.com/creating_integrations/snowflake_connection/creating_a_snowflake_connection.md),
  with its security integration set up in Snowflake. Until one exists, the element is disabled in the **Add
  Element** pop-up.
* Every viewer needs a Snowflake user whose login name equals their Curator username and that is granted the
  connection's role, as for any Snowflake connection. Viewers who are not signed in see "Sign in to view this app."
* The app runs on a container runtime with Streamlit 1.53.0 or later. Apps on a warehouse runtime cannot be
  embedded.
* The portal's address is registered in Snowflake, and the connection's role has `USAGE` and `EMBED` on the app.
  The **Streamlit embedding** section of the Snowflake connection shows the statements to run. See
  [Allowing Streamlit apps on pages](https://docs.curator.interworks.com/creating_integrations/snowflake_connection/creating_a_snowflake_connection.md#allowing-streamlit-apps-on-pages).
* The portal is served over `https`. Snowflake does not embed apps in pages served over plain `http`.

## Adding a Streamlit app to a page

1. In the [backend of Curator](https://docs.curator.interworks.com/site_administration/accessing_the_backend.md) using the left-hand navigation,
   navigate to the
   **Content**
   \>
   **Pages**

   page.
2. Find the page you'd like to add the app to, or click the "+ New Page" button.
3. Select the element you'd like to use, or click the plus (+) icon to add a new blank element.
4. In the "Add Element" pop-up, click on the **Analytic Elements** tab at the top and select the **Snowflake
   Streamlit App** option.
5. In the **Snowflake Streamlit App Settings** section on the left-hand side, fill in the fields:

| Field | What to enter |
| - | - |
| **Streamlit app** | The app's fully qualified name, `DATABASE.SCHEMA.APP_NAME`, for example `ANALYTICS.APPS.SALES_APP`. Use the name as Snowflake stores it: upper case, unless the app was created with a quoted name. Quoted names that need the quotes are not supported. |
| **Height (pixels)** | The height of the app's frame, 200 to 4000 pixels. The default is 800. |
| **Loading message** | Shown while the app starts. The default is "Starting the app...". Snowflake can take a few minutes to start an app that has not run for a while, so a message that says so can help viewers wait. |

6. Click **Save**.

Each time the page opens, Curator asks Snowflake for a new single-use address for the app, so the app loads fresh
for each viewer and each visit.

## What viewers can see

| Message | What it means |
| - | - |
| This app cannot be shown because no active Snowflake connection is configured. | The portal has no active Snowflake connection. |
| Sign in to view this app. | The viewer is not signed in to Curator. |
| This app cannot be shown because the element does not name a Streamlit app as DATABASE.SCHEMA.APP\_NAME. | The **Streamlit app** field is empty or not in the `DATABASE.SCHEMA.APP_NAME` form. |
| Snowflake refused to open this app for you... | Snowflake rejected the viewer. Either the viewer's Curator username has no matching Snowflake user, or the connection's role lacks `USAGE` or `EMBED` on the app. Snowflake gives the same answer for both, so check each. |
| Snowflake could not open this app... | Snowflake refused the app itself, for example because the app does not exist, its runtime cannot be embedded, or the portal's address is not registered. The message includes Snowflake's own words. |
| Snowflake only embeds apps in pages served over https... | The page was opened over plain `http`. |
| Snowflake did not answer. | Snowflake could not be reached. The Snowflake connection is marked as failing, as it is when page queries fail. |
| The app session ended. / The app was paused after a period of inactivity. | Snowflake ended or suspended the app while the page was open. Click **Reload app** to start it again. |
| This page has been open too long. Reload the page. | The page was open for more than eight hours when the app needed to load again. Click **Reload page**. |

## Good to know

* Each viewer may load up to 20 apps per minute.
* Curator records each app load in its audit log with the viewer, the page, and the app, never the address
  Snowflake returned.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.