connecting-streamlit-to-snowflake

Connect Streamlit applications to Snowflake databases using st.connection.

1|1|Updated Nov 9, 2025
One-click install
npx skills add https://github.com/Paldom/databricks-apps-streamlit-vibe-coding-starter --skill connecting-streamlit-to-snowflake-paldom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: connecting-streamlit-to-snowflake
Source: https://github.com/Paldom/databricks-apps-streamlit-vibe-coding-starter/tree/main/.agents/skills/developing-with-streamlit/skills/connecting-streamlit-to-snowflake
Command: npx skills add https://github.com/Paldom/databricks-apps-streamlit-vibe-coding-starter --skill connecting-streamlit-to-snowflake-paldom

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the process of securely connecting Streamlit applications to Snowflake databases, enabling efficient data querying and manipulation.

Core Features & Use Cases

  • st.connection: Utilizes Streamlit's built-in connection management for robust Snowflake integration.
  • Caller's Rights: Supports running queries with the viewer's permissions for enhanced security and data segregation.
  • Caching: Implements query caching to improve performance and reduce redundant data fetching.
  • Secret Management: Integrates with st.secrets for secure storage of Snowflake credentials.
  • Parameterized Queries: Protects against SQL injection by using parameterized queries.
  • Data Writing: Enables writing dataframes and executing SQL statements via st.connection.session.
  • Cortex LLM Integration: Facilitates building chat interfaces powered by Snowflake Cortex LLMs.
  • Use Case: Securely connect your Streamlit dashboard to Snowflake, display sales data, and allow users to filter by region using their own permissions, all while caching frequently accessed data for speed.

Quick Start

Use st.connection("snowflake") to establish a connection to your Snowflake database.

Frequently Asked Questions about connecting-streamlit-to-snowflake

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I connect Streamlit to Snowflake securely?

To connect Streamlit to Snowflake securely, use the st.connection function to establish a database connection and manage your credentials safely via st.secrets. This approach leverages built-in connection management for robust integration.

Can I run Snowflake queries with the viewer's permissions in Streamlit?

Yes, you can run Snowflake queries with the viewer's permissions by implementing caller's rights. This technique enhances security and ensures data segregation by executing operations under the specific viewer's credentials.

What is the best way to cache Snowflake data queries in a Streamlit app?

The best way to cache Snowflake data queries in a Streamlit app is utilizing the caching mechanism provided by st.connection. This reduces redundant data fetching and improves dashboard performance for frequently accessed datasets.

Does Streamlit support writing dataframes back to a Snowflake database?

Yes, Streamlit supports writing dataframes back to a Snowflake database. You can execute SQL statements and write dataframes directly by accessing the database session through st.connection.session.

How do I protect against SQL injection when querying Snowflake in Streamlit?

To protect against SQL injection when querying Snowflake in Streamlit, use parameterized queries. This method safely separates user input from SQL code, preventing malicious execution and ensuring secure data querying.

Can I integrate Snowflake Cortex LLMs into a Streamlit chat interface?

Yes, you can integrate Snowflake Cortex LLMs into a Streamlit chat interface. This connection method facilitates building chat applications powered by Cortex directly within your Streamlit dashboard environment.