How to create multipage streamlit app in Snnowflake's snowsight

Welcome to the community and thanks for your question! :balloon: To create a multipage Streamlit app in Snowflake’s Snowsight, you’ll use the same core approach as standard Streamlit: a main entrypoint file (like streamlit_app.py) and a pages/ folder containing additional .py files for each page. Snowsight will automatically generate a sidebar navigation for these pages.

Steps:

  1. In Snowsight, create your main file (e.g., streamlit_app.py). This will be your app’s homepage.
  2. Create a pages folder in your app’s file structure.
  3. Add additional Python files (e.g., 1_Overview.py, 2_Topic_Details.py) to the pages folder. Each file becomes a separate page in the sidebar.
  4. The sidebar will display page names based on filenames (numbers and underscores are handled automatically).
  5. To change the main page’s name in the sidebar, create a new file (e.g., Home.py), copy your code there, and set it as the entrypoint using the ALTER STREAMLIT SQL command:
    alter streamlit "<APP_IDENTIFIER>" set main_file = 'Home.py';
    
    Replace <APP_IDENTIFIER> with your app’s identifier from the URL or by running show streamlits in a worksheet.

For more control over navigation (custom names, icons, or dynamic menus), use st.Page and st.navigation in your entrypoint file. This lets you define pages and their properties programmatically.

Sources: