Build Apps on Snowflake Postgres with Streamlit
Streamlit is an open source Python framework that turns scripts into shareable web apps. Streamlit in Snowflake (SiS) takes this further by running your apps directly inside the Snowflake platform — no external hosting required.
Key Benefits
- Pure Python — No HTML, CSS, or JavaScript required. Build UIs with Python functions.
- Secure by default — Apps run within Snowflake's security perimeter. Data never leaves the platform.
- Zero infrastructure — No servers to provision, no containers to manage, no CI/CD to configure.
- Role-based access — Share apps with specific roles and users using Snowflake's access control.
Architecture
Streamlit apps in Snowflake execute in a secure sandbox attached to a virtual warehouse. They can access any data the app's owner role can see — including Snowflake Postgres data directly, tables synced via pg_lake, Iceberg tables, or data replicated through Openflow CDC connectors.
Connect to Postgres Data
Streamlit apps can access Snowflake Postgres data in two ways: connecting directly to the Postgres instance, or querying pg_lake-synced tables within Snowflake.
Option 1: Connect Directly to Snowflake Postgres
For apps that need real-time access to operational data, use a standard PostgreSQL connection library like psycopg2. This gives you the latest transactional data with no sync delay — the same connection experience as any other Postgres client.
Option 2: Query Synced Tables via pg_lake
If your Postgres tables are synced to Snowflake using pg_lake, query them directly with Snowpark. This approach is ideal when you want warehouse-scale analytics on Postgres data without hitting the operational database.
What You Can Build
Streamlit combined with Snowflake Postgres and Cortex AI gives you a rich set of capabilities for building data applications:
- Interactive charts and graphs — Line charts, bar charts, area charts, and donut charts using Plotly, with data pulled live from Postgres.
- KPI dashboards — Metric cards showing real-time numbers (revenue, active users, churn rate) that update with filters and selections.
- Interactive maps — Clickable world maps using PyDeck, colored by metrics like MRR or user count, where clicking a region filters the entire dashboard.
- AI chatbots — Conversational agents powered by Cortex AI (
SNOWFLAKE.CORTEX.COMPLETE) that answer natural language questions grounded in your live Postgres data. - Natural language chart generation — Users describe a chart in plain English, Cortex generates the SQL, and the app renders a Plotly visualization.
- Semantic search — pgvector embeddings (generated via
SNOWFLAKE.CORTEX.EMBED_TEXT_1024) let users search by meaning rather than exact keywords. - Role-based navigation — Show different pages and data to different user roles (analysts, managers, executives).
- CDC-powered real-time views — Dashboards backed by Dynamic Tables that auto-refresh from PostgreSQL change data capture.
- Multi-page apps — Organize complex apps into multiple pages with
st.navigationfor a polished user experience.
Deploy and Share
Deploy Your App
- Open Snowsight and navigate to Projects > Streamlit.
- Click + Streamlit App to create a new application.
- Select the database, schema, and warehouse for your app.
- Paste your Python code into the editor.
- Click Run to preview your app in the browser.
You can also deploy from the command line using snow streamlit deploy with the Snowflake CLI.
Share with Your Team
- Grant access to specific Snowflake roles using
GRANT USAGE ON STREAMLIT. - Share a direct URL with authorized users.
- Apps respect Snowflake's row-level and column-level security policies automatically.
Conclusion
Streamlit in Snowflake gives you a fast path from Postgres data to interactive applications — dashboards, AI chatbots, semantic search, and more — entirely within the Snowflake platform.
Related Resources
Documentation for building and deploying Streamlit apps in Snowflake.
Comprehensive documentation for Snowflake Postgres features and configuration.
Quickstart Guides
Build a full SaaS analytics dashboard with an interactive world map, AI agent, charts on demand, and semantic search — all backed by Snowflake Postgres and Cortex AI, built using Cortex Code.
Build a multi-page IoT sensor dashboard with interactive charts, a natural language chart generator, and an AI chatbot — all powered by Snowflake Postgres and Cortex AI.
Build a real-time financial BI dashboard using Change Data Capture from PostgreSQL, Dynamic Tables, and Streamlit in Snowflake.
Set up real-time CDC from PostgreSQL using Snowflake Openflow with a healthcare analytics scenario including Streamlit dashboards and Snowflake Intelligence.
Create your first Snowflake Postgres instance, connect to it, and run sample queries.
Set up pg_lake to sync operational Postgres data to Snowflake Iceberg tables — the data pipeline that powers Streamlit apps querying synced data.
This content is provided as is, and is not maintained on an ongoing basis. It may be out of date with current Snowflake instances