Loading...
Loading...
Build and deploy Streamlit apps natively in Snowflake. Covers snowflake.yml scaffolding, Snowpark sessions, multi-page structure, Marketplace publishing as Native Apps, and caller's rights connections (v1.53.0+). Use when building data apps on Snowflake, deploying SiS, fixing package channel errors, authentication issues, cache key bugs, or path resolution errors.
npx skill4agent add jezweb/claude-skills streamlit-snowflake# Create project directory
mkdir my-streamlit-app && cd my-streamlit-app
# Copy templates (Claude will provide these)snowflake.ymldefinition_version: 2
entities:
my_app:
type: streamlit
identifier: my_streamlit_app # ← Your app name
stage: my_app_stage # ← Your stage name
query_warehouse: my_warehouse # ← Your warehouse
main_file: streamlit_app.py
pages_dir: pages/
artifacts:
- common/
- environment.yml# Deploy to Snowflake
snow streamlit deploy --replace
# Open in browser
snow streamlit deploy --replace --openenvironment.ymlrequirements.txtpyproject.tomlCREATE STREAMLIT my_app
FROM '@my_stage/app_folder'
MAIN_FILE = 'streamlit_app.py'
RUNTIME_NAME = 'SYSTEM$ST_CONTAINER_RUNTIME_PY3_11'
COMPUTE_POOL = my_compute_pool
QUERY_WAREHOUSE = my_warehouse;my-streamlit-app/
├── snowflake.yml # Project definition (required)
├── environment.yml # Package dependencies (required)
├── streamlit_app.py # Main entry point
├── pages/ # Multi-page apps
│ └── data_explorer.py
├── common/ # Shared utilities
│ └── utils.py
└── .gitignoreimport streamlit as st
# Get Snowpark session (native SiS connection)
conn = st.connection("snowflake")
session = conn.session()
# Query data
df = session.sql("SELECT * FROM my_table LIMIT 100").to_pandas()
st.dataframe(df)import streamlit as st
# Use caller's rights for data isolation
conn = st.connection("snowflake", type="callers_rights")
# Each viewer sees only data they have permission to access
df = conn.query("SELECT * FROM sensitive_customer_data")
st.dataframe(df)| Connection Type | Privilege Model | Use Case |
|---|---|---|
| Owner's rights | Internal tools, trusted users |
| Caller's rights | Public apps, data isolation |
@st.cache_data(ttl=600) # Cache for 10 minutes
def load_data(query: str):
conn = st.connection("snowflake")
return conn.session().sql(query).to_pandas()
# Use cached function
df = load_data("SELECT * FROM large_table")paramsttl=0# ❌ Fetches all 50 columns even though chart only needs 2
df = session.table("wide_table") # 50 columns
st.line_chart(df, x="date", y="value")
# ✅ Fetch only needed columns for better performance
df = session.table("wide_table").select("date", "value")
st.line_chart(df, x="date", y="value")
# 5-10x faster for wide tablesst.dataframe()df.to_pandas()name: sf_env
channels:
- snowflake # REQUIRED - only supported channel
dependencies:
- streamlit=1.35.0 # Explicit version (default is old 1.22.0)
- pandas
- plotly
- altair=4.0 # Version 4.0 supported in SiS
- snowflake-snowpark-python| Error | Cause | Prevention |
|---|---|---|
| Using conda-forge or external channel | Use |
| Missing Streamlit features | Default version 1.22.0 | Explicitly set |
| Old CLI syntax | Use Snowflake CLI 3.14.0+ with |
| Auth failures (2026+) | Password-only authentication | Use key-pair or OAuth (see references/authentication.md) |
| File upload fails | File >200MB | Keep uploads under 200MB limit |
| DataFrame display fails | Data >32MB | Paginate or limit data before display |
| SiS limitation | Don't use |
| Custom component error | SiS limitation | Only components without external service calls work |
| Container Runtime migration | Use |
| Cached query returns wrong data with different params | | Use |
| Missing secrets.toml or connections.toml | Create minimal |
| Native App upgrades unexpectedly | Implicit default Streamlit version (BCR-1857) | Explicitly set |
| File paths fail in Container Runtime subdirectories | Some commands use entrypoint-relative paths | Use |
| Slow performance with wide Snowpark DataFrames | | Pre-select only needed columns: |
# Deploy and replace existing
snow streamlit deploy --replace
# Deploy and open in browser
snow streamlit deploy --replace --open
# Deploy specific entity (if multiple in snowflake.yml)
snow streamlit deploy my_app --replacereferences/ci-cd.mdtemplates-native-app/templates-native-app/README.mdmy-native-app/
├── manifest.yml # Native App manifest
├── setup.sql # Installation script
├── streamlit/
│ ├── environment.yml
│ ├── streamlit_app.py
│ └── pages/
└── README.md-- Query available packages
SELECT * FROM information_schema.packages
WHERE language = 'python'
ORDER BY package_name;
-- Search for specific package
SELECT * FROM information_schema.packages
WHERE language = 'python'
AND package_name ILIKE '%plotly%';st.dataframest.file_uploader.sost.set_page_configpage_titlepage_iconmenu_itemsst.bokeh_charteval()st.cache_datast.cache_resource| Milestone | Date | Requirement |
|---|---|---|
| Milestone 1 | Sept 2025 - Jan 2026 | MFA required for Snowsight users |
| Milestone 2 | May - July 2026 | All new users must use MFA |
| Milestone 3 | Aug - Oct 2026 | All users must use MFA or key-pair/OAuth |
references/authentication.md