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) runs those apps inside your Snowflake account, so there's no separate hosting to set up.
Key Benefits
You write the whole app in Python. No HTML, CSS, or JavaScript.
Apps run inside Snowflake's security perimeter and use Snowflake's role-based access control, so sharing an app with a team is a grant, not a deployment project.
There are no servers to provision and no containers for you to manage.
Architecture
Streamlit apps in Snowflake run on Snowflake-managed compute and can read any data the app's owner role can see. For Postgres-backed apps, that means a direct connection to your Snowflake Postgres instance, Iceberg tables written by pg_lake, mirrored tables, or data replicated through Openflow CDC connectors.
Connect to Postgres Data
There are two main ways to get Postgres data into a Streamlit app: connect straight to the Postgres instance, or query tables that already live in Snowflake.
Option 1: Connect Directly to Snowflake Postgres
When the app needs current operational data, connect with a regular Postgres driver like psycopg2. You get the latest committed rows with no sync delay, and it works like any other Postgres client. The app still needs a network path to the instance, so make sure the instance's network policy allows it and the app has the external access it needs. Keep heavy analytical queries off this path, since they run on your OLTP instance.
Option 2: Query Tables in Snowflake
If you share Postgres tables with Snowflake using pg_lake or data mirroring, query them with Snowpark like any other Snowflake table. This is the better choice for dashboards that scan a lot of data, because the warehouse does the work and your Postgres instance never notices.
What You Can Build
Here are some of the things we've seen people build with Streamlit, Snowflake Postgres, and Cortex AI:
- Charts with Plotly (line, bar, area, donut) pulling live data from Postgres
- KPI dashboards with metric cards for revenue, active users, or churn that update as users change filters
- Interactive maps with PyDeck, colored by a metric like MRR, where clicking a region filters the rest of the dashboard
- Chatbots that use Cortex AI (
SNOWFLAKE.CORTEX.COMPLETE) to answer natural language questions grounded in your Postgres data - Natural language chart generation, where a user describes a chart, Cortex writes the SQL, and the app renders it
- Semantic search over pgvector embeddings generated with
SNOWFLAKE.CORTEX.EMBED_TEXT_1024 - Role-based navigation that shows analysts, managers, and executives different pages
- Near real-time views backed by Dynamic Tables that refresh from Postgres change data capture
- Multi-page apps organized with
st.navigation
Deploy and Share
Deploy Your App
- Open Snowsight and go to the Streamlit section under Projects.
- Create a new Streamlit app.
- Pick the database, schema, and warehouse for the app.
- Paste your Python code into the editor.
- Select Run to preview it.
If you'd rather work from your editor, deploy with snow streamlit deploy from the Snowflake CLI.
Share with Your Team
Grant access to specific roles with GRANT USAGE ON STREAMLIT, then send the app URL to people in those roles. Row access and masking policies on the underlying Snowflake tables still apply when the app queries them.
Conclusion
Streamlit in Snowflake is a quick way to go from Postgres data to a working app, whether that's a dashboard, a chatbot, or semantic search, without leaving the Snowflake platform.
Related Resources
Documentation for building and deploying Streamlit apps in Snowflake.
Documentation for Snowflake Postgres features and configuration.
Quickstart Guides
Build a SaaS analytics dashboard with an interactive world map, an AI agent, charts on demand, and semantic search, backed by Snowflake Postgres and Cortex AI and built using Cortex Code.
Build a multi-page IoT sensor dashboard with interactive charts, a natural language chart generator, and an AI chatbot using 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. This is the pipeline behind Streamlit apps that query 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