$ show Snowflake-Labs/snowflake-demo-streamlit
This repository is a curated collection of over 30 independent Streamlit in Snowflake (SiS) demo applications, each self-contained in its own folder. The demos span a wide range of use cases including business intelligence dashboards, LLM-powered chatbots (Cortex, DeepSeek-R1, RAG), geospatial H3 visualizations, custom UI components (AgGrid, ECharts, Slickgrid), CI/CD pipelines with Snowflake CLI, and embedding SiS into external portals via Next.js. Each app includes a `streamlit_app.py` entry point, a `data/creation_script.sql` for Snowflake object setup, and sample data. The code is educational, heavily commented, and demonstrates patterns like caching, dynamic page navigation, and local/cloud-aware connections. While the apps are not production-grade (some hardcoded values, duplication), they serve as excellent reference implementations for building SiS applications.
The LLM identified 5 files worth highlighting for reuse:
Demonstrates bidirectional communication between Streamlit and an AgGrid custom component. The app sends data to AgGrid, captures user edits, and reflects changes back in Streamlit. This pattern is reusable for any interactive table editing use case where real-time sync is needed.
Provides a reusable CSS template and a copy-to-clipboard utility function. The template uses Streamlit's `st.html` to inject custom styles for buttons, headers, sliders, and layout containers. This module can be extracted and adapted to apply consistent branding or widget styling across any Streamlit app.
Implements a Next.js API route that generates a single-use embed URL for a Streamlit in Snowflake app using `SYSTEM$STREAMLIT_GENERATE_EMBED_URL`. The pattern handles authentication via PAT, key-pair, or WIF, and uses `useRef` to prevent double-minting. This is a clean, reusable pattern for embedding SiS apps into external portals.
Defines a `data_chart_container` function that creates a four-tab layout (Chart, Data Preview, SQL, Description) for displaying analytical results. This pattern is reused across multiple apps (GitHub Stars, Language Usage, etc.) and can be extracted as a generic component for any data-driven Streamlit dashboard.
Implements a `show_pages()` function that dynamically builds a sidebar navigation from a list of page definitions. This pattern is used in several apps to manage multi-page layouts without hardcoding page names. It is reusable for any Streamlit app that needs a configurable, data-driven page menu.