[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KGGXTZ8NN2NJR1TXZTVC2N":3,"skill-same:01M6KGGXTZ8NN2NJR1TXZTVC2N":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":34,"commitSha":35,"skillDirectory":36,"forksCount":37,"repositoryHtmlUrl":38,"repositoryHomepageUrl":6,"ownerHtmlUrl":39,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":40,"install":41,"resources":54},"01M6KGGXTZ8NN2NJR1TXZTVC2N","connecting-streamlit-to-snowflake",null,"Connecting Streamlit apps to Snowflake. Use when setting up database connections, managing secrets, or querying Snowflake from a Streamlit app.","legout\u002Fpi-config","legout","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1469563?v=4","01M6KGERP7E8TF4XARRKPFJ6HQ","Volker L.","01M6KGERT1FYD049PP1WW923TZ",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fconnecting-streamlit-to-snowflake\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28],"snowflake","streamlit","connecting streamlit to snowflake","database","secrets","use","up","connections","app","apps","2026-11-10 10:12:30",false,"---\nname: connecting-streamlit-to-snowflake\ndescription: Connecting Streamlit apps to Snowflake. Use when setting up database connections, managing secrets, or querying Snowflake from a Streamlit app.\nlicense: Apache-2.0\n---\n\n# Streamlit Snowflake connection\n\nConnect your Streamlit app to Snowflake the right way.\n\n## Use st.connection\n\nAlways use `st.connection(\"snowflake\")` instead of raw connectors.\n\n```python\nimport streamlit as st\n\nconn = st.connection(\"snowflake\")\n\n# Query data\ndf = conn.query(\"SELECT * FROM my_table LIMIT 100\")\nst.dataframe(df)\n```\n\n**Why st.connection:**\n- Automatic connection pooling\n- Built-in caching\n- Handles reconnection\n- Works with st.secrets\n\n## Caller's rights connection (Streamlit 1.53+)\n\nFor apps running in Snowflake, use caller's rights to run queries with the viewer's permissions instead of the app owner's:\n\n```python\nconn = st.connection(\"snowflake\", type=\"snowflake-callers-rights\")\n```\n\nThis is useful when:\n- Different users should see different data based on their Snowflake roles\n- You want row-level security to apply based on the viewer\n- You don't want the app to have elevated permissions\n\n## Cached queries\n\nUse the built-in `ttl` parameter to cache query results:\n\n```python\nfrom datetime import timedelta\n\nconn = st.connection(\"snowflake\")\n\n# Cache for 10 minutes\ndf = conn.query(\"SELECT * FROM metrics\", ttl=timedelta(minutes=10))\n\n# Cache for 1 hour\ndf = conn.query(\"SELECT * FROM reference_data\", ttl=3600)\n```\n\n## Configure with st.secrets\n\nStore credentials in `.streamlit\u002Fsecrets.toml` (never commit this file).\n\n**CRITICAL**: Derive the `account` and `host` values from the user's Snowflake CLI connection config. Run `snow connection list` and use the exact values. A wrong `account` will redirect to the wrong login page.\n\n```toml\n# .streamlit\u002Fsecrets.toml\n[connections.snowflake]\naccount = \"ORGNAME-ACCTNAME\"            # from `snow connection list`\nhost = \"myaccount.snowflakecomputing.com\"  # from `snow connection list` (include if present)\nuser = \"your_user\"\nauthenticator = \"externalbrowser\"\nwarehouse = \"your_warehouse\"\ndatabase = \"your_database\"\nschema = \"your_schema\"\n```\n\nAdd to `.gitignore`:\n```\n.streamlit\u002Fsecrets.toml\n```\n\n## Parameterized queries\n\nUse parameters to prevent SQL injection:\n\n```python\nconn = st.connection(\"snowflake\")\n\n# Safe: parameterized\ndf = conn.query(\n    \"SELECT * FROM users WHERE region = :region\",\n    params={\"region\": selected_region}\n)\n\n# UNSAFE: string formatting - don't do this\n# df = conn.query(f\"SELECT * FROM users WHERE region = '{selected_region}'\")\n```\n\n## Write data\n\nUse the session for write operations:\n\n```python\nconn = st.connection(\"snowflake\")\nsession = conn.session()\n\n# Write a dataframe\nsession.write_pandas(df, \"MY_TABLE\", auto_create_table=True)\n\n# Execute statements\nsession.sql(\"INSERT INTO logs VALUES (:ts, :msg)\", params={...}).collect()\n```\n\n## Multiple connections\n\nDefine multiple connections in secrets:\n\n```toml\n# .streamlit\u002Fsecrets.toml\n[connections.snowflake]\naccount = \"prod_account\"\n# ... prod credentials\n\n[connections.snowflake_staging]\naccount = \"staging_account\"\n# ... staging credentials\n```\n\n```python\nprod_conn = st.connection(\"snowflake\")\nstaging_conn = st.connection(\"snowflake_staging\")\n```\n\n## Chat with Cortex\n\nBuild a chat interface using Snowflake Cortex LLMs:\n\n```python\nimport streamlit as st\nfrom snowflake.cortex import complete\n\nst.set_page_config(page_title=\"AI Assistant\", page_icon=\":sparkles:\")\n\nif \"messages\" not in st.session_state:\n    st.session_state.messages = []\n\nfor msg in st.session_state.messages:\n    with st.chat_message(msg[\"role\"]):\n        st.write(msg[\"content\"])\n\nif prompt := st.chat_input(\"Ask anything\"):\n    st.session_state.messages.append({\"role\": \"user\", \"content\": prompt})\n\n    with st.chat_message(\"user\"):\n        st.write(prompt)\n\n    with st.chat_message(\"assistant\"):\n        response = st.write_stream(\n            complete(\n                \"claude-3-5-sonnet\",\n                prompt,\n                session=st.connection(\"snowflake\").session(),\n                stream=True,\n            )\n        )\n\n    st.session_state.messages.append({\"role\": \"assistant\", \"content\": response})\n```\n\nSee `building-streamlit-chat-ui` for more chat patterns (avatars, suggestions, history management).\n\n## Python 3.12+ dependency caveat\n\n`streamlit[snowflake]` gates `snowflake-connector-python` on `python_version \u003C \"3.12\"`. On Python 3.12+, the connector is silently skipped and you get `No module named 'snowflake'` at runtime. Always add `snowflake-connector-python>=3.3.0` as an explicit dependency in `pyproject.toml`:\n\n```toml\ndependencies = [\n    \"snowflake-connector-python>=3.3.0\",\n    \"streamlit[snowflake]>=1.54.0\",\n]\n```\n\n## References\n\n- [st.connection](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconnections\u002Fst.connection)\n- [SnowflakeConnection](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconnections\u002Fst.connections.snowflakeconnection)\n- [st.secrets](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconnections\u002Fst.secrets)\n","# Streamlit Snowflake connection\n\nConnect your Streamlit app to Snowflake the right way.\n\n## Use st.connection\n\nAlways use `st.connection(\"snowflake\")` instead of raw connectors.\n\n```python\nimport streamlit as st\n\nconn = st.connection(\"snowflake\")\n\n# Query data\ndf = conn.query(\"SELECT * FROM my_table LIMIT 100\")\nst.dataframe(df)\n```\n\n**Why st.connection:**\n- Automatic connection pooling\n- Built-in caching\n- Handles reconnection\n- Works with st.secrets\n\n## Caller's rights connection (Streamlit 1.53+)\n\nFor apps running in Snowflake, use caller's rights to run queries with the viewer's permissions instead of the app owner's:\n\n```python\nconn = st.connection(\"snowflake\", type=\"snowflake-callers-rights\")\n```\n\nThis is useful when:\n- Different users should see different data based on their Snowflake roles\n- You want row-level security to apply based on the viewer\n- You don't want the app to have elevated permissions\n\n## Cached queries\n\nUse the built-in `ttl` parameter to cache query results:\n\n```python\nfrom datetime import timedelta\n\nconn = st.connection(\"snowflake\")\n\n# Cache for 10 minutes\ndf = conn.query(\"SELECT * FROM metrics\", ttl=timedelta(minutes=10))\n\n# Cache for 1 hour\ndf = conn.query(\"SELECT * FROM reference_data\", ttl=3600)\n```\n\n## Configure with st.secrets\n\nStore credentials in `.streamlit\u002Fsecrets.toml` (never commit this file).\n\n**CRITICAL**: Derive the `account` and `host` values from the user's Snowflake CLI connection config. Run `snow connection list` and use the exact values. A wrong `account` will redirect to the wrong login page.\n\n```toml\n# .streamlit\u002Fsecrets.toml\n[connections.snowflake]\naccount = \"ORGNAME-ACCTNAME\"            # from `snow connection list`\nhost = \"myaccount.snowflakecomputing.com\"  # from `snow connection list` (include if present)\nuser = \"your_user\"\nauthenticator = \"externalbrowser\"\nwarehouse = \"your_warehouse\"\ndatabase = \"your_database\"\nschema = \"your_schema\"\n```\n\nAdd to `.gitignore`:\n```\n.streamlit\u002Fsecrets.toml\n```\n\n## Parameterized queries\n\nUse parameters to prevent SQL injection:\n\n```python\nconn = st.connection(\"snowflake\")\n\n# Safe: parameterized\ndf = conn.query(\n    \"SELECT * FROM users WHERE region = :region\",\n    params={\"region\": selected_region}\n)\n\n# UNSAFE: string formatting - don't do this\n# df = conn.query(f\"SELECT * FROM users WHERE region = '{selected_region}'\")\n```\n\n## Write data\n\nUse the session for write operations:\n\n```python\nconn = st.connection(\"snowflake\")\nsession = conn.session()\n\n# Write a dataframe\nsession.write_pandas(df, \"MY_TABLE\", auto_create_table=True)\n\n# Execute statements\nsession.sql(\"INSERT INTO logs VALUES (:ts, :msg)\", params={...}).collect()\n```\n\n## Multiple connections\n\nDefine multiple connections in secrets:\n\n```toml\n# .streamlit\u002Fsecrets.toml\n[connections.snowflake]\naccount = \"prod_account\"\n# ... prod credentials\n\n[connections.snowflake_staging]\naccount = \"staging_account\"\n# ... staging credentials\n```\n\n```python\nprod_conn = st.connection(\"snowflake\")\nstaging_conn = st.connection(\"snowflake_staging\")\n```\n\n## Chat with Cortex\n\nBuild a chat interface using Snowflake Cortex LLMs:\n\n```python\nimport streamlit as st\nfrom snowflake.cortex import complete\n\nst.set_page_config(page_title=\"AI Assistant\", page_icon=\":sparkles:\")\n\nif \"messages\" not in st.session_state:\n    st.session_state.messages = []\n\nfor msg in st.session_state.messages:\n    with st.chat_message(msg[\"role\"]):\n        st.write(msg[\"content\"])\n\nif prompt := st.chat_input(\"Ask anything\"):\n    st.session_state.messages.append({\"role\": \"user\", \"content\": prompt})\n\n    with st.chat_message(\"user\"):\n        st.write(prompt)\n\n    with st.chat_message(\"assistant\"):\n        response = st.write_stream(\n            complete(\n                \"claude-3-5-sonnet\",\n                prompt,\n                session=st.connection(\"snowflake\").session(),\n                stream=True,\n            )\n        )\n\n    st.session_state.messages.append({\"role\": \"assistant\", \"content\": response})\n```\n\nSee `building-streamlit-chat-ui` for more chat patterns (avatars, suggestions, history management).\n\n## Python 3.12+ dependency caveat\n\n`streamlit[snowflake]` gates `snowflake-connector-python` on `python_version \u003C \"3.12\"`. On Python 3.12+, the connector is silently skipped and you get `No module named 'snowflake'` at runtime. Always add `snowflake-connector-python>=3.3.0` as an explicit dependency in `pyproject.toml`:\n\n```toml\ndependencies = [\n    \"snowflake-connector-python>=3.3.0\",\n    \"streamlit[snowflake]>=1.54.0\",\n]\n```\n\n## References\n\n- [st.connection](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconnections\u002Fst.connection)\n- [SnowflakeConnection](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconnections\u002Fst.connections.snowflakeconnection)\n- [st.secrets](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconnections\u002Fst.secrets)\n",{"name":5,"license":15,"description":7},"main","3efae68c898153694a2f4aad309c7ff9847b5602","installed-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fconnecting-streamlit-to-snowflake",0,"https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config","https:\u002F\u002Fgithub.com\u002Flegout","2026-04-28 16:32:33",{"source":8,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add legout\u002Fpi-config --skill connecting-streamlit-to-snowflake",{"tool":47,"command":48},"bunx","bunx skills add legout\u002Fpi-config --skill connecting-streamlit-to-snowflake",{"tool":50,"command":51},"pnpm","pnpm dlx skills add legout\u002Fpi-config --skill connecting-streamlit-to-snowflake","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fconnecting-streamlit-to-snowflake\u002FSKILL.md",true,[],[56,93,121,136,154,175],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":60,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":73,"publishedAt":29},"01M6KGW7MYKZ8MWFKN1V8ZJ2EG","visual-explainer","Generate beautiful, self-contained HTML pages that visually explain systems, code changes, plans, and data. Use when the user asks for a diagram, architecture overview, diff review, plan review, project recap, comparison table, or any visual explanation of technical concepts. Also use proactively when you are about to render a complex ASCII table (4+ rows or 3+ columns) — present it as a styled HTML page instead.","MIT","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Fskills\u002Fvisual-explainer\u002FSKILL.md",[63,68],{"categoryNo":64,"categoryName":65,"taxonomyType":66,"taxonomyTypeDesc":67},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",{"categoryNo":69,"categoryName":70,"taxonomyType":71,"taxonomyTypeDesc":72},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[74,75,76,77,78,79,80,81,82,24,83,84,85,86,87,88,89,90,91,92],"visual explainer","explainer","visual","image","architecture","generate","plan","table","view","files","project","present","as","ascii table","ascii","you","concepts","surf","for",{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":60,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":105,"publishedAt":29},"01M6KGTMTJR6RXXC8AF29MQQW5","table-extractor",">","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Ftable-extractor\u002FSKILL.md",[99,102],{"categoryNo":100,"categoryName":101,"taxonomyType":66,"taxonomyTypeDesc":67},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":103,"categoryName":104,"taxonomyType":66,"taxonomyTypeDesc":67},"01JBSEEDCAT000000000000023","Skill与智能体开发",[81,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120],"table extractor","PDF","MCP","gpt","extraction","office","data","parsing","extract","en","zh","camelot","sonnet","opus","tables",{"skillNo":122,"name":123,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":60,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":128,"publishedAt":29},"01M6KGSWF2R22Z63PAY5NT6GRY","smart-ocr","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fsmart-ocr\u002FSKILL.md",[126,127],{"categoryNo":100,"categoryName":101,"taxonomyType":66,"taxonomyTypeDesc":67},{"categoryNo":103,"categoryName":104,"taxonomyType":66,"taxonomyTypeDesc":67},[129,130,107,108,131,109,110,111,113,132,114,115,116,133,134,118,119,135],"ocr","smart ocr","support","text","multilingual","processing","paddleocr",{"skillNo":137,"name":138,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":60,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":146,"publishedAt":29},"01M6KGMKKFNC1PRNX2W3E243DR","html-slides","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fhtml-slides\u002FSKILL.md",[141,144,145],{"categoryNo":142,"categoryName":143,"taxonomyType":66,"taxonomyTypeDesc":67},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":64,"categoryName":65,"taxonomyType":66,"taxonomyTypeDesc":67},{"categoryNo":103,"categoryName":104,"taxonomyType":66,"taxonomyTypeDesc":67},[147,148,149,150,108,151,109,111,115,116,152,153,118,119],"slides","html","html slides","pptx","web","revealjs","presentation",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":160,"publishedAt":29},"01M6KGJGVM0TWW632Y6VQQV2WN","using-streamlit-session-state","Using st.session_state to manage state across Streamlit reruns. Use when persisting data, handling widget state, implementing callbacks, or debugging state issues. Covers initialization patterns, widget-state association, and common gotchas.","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fusing-streamlit-session-state\u002FSKILL.md",[],[161,162,20,163,164,165,166,112,167,24,168,169,170,171,172,173,174],"state","session","session state","using streamlit session state","debugging","issues","common","manage","patterns","across","widget","Callbacks","implementing","initialization",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":182,"publishedAt":29},"01M6KGJD12GJB7W0ZG66JK00F6","using-streamlit-markdown","Covers all Markdown features in Streamlit including GitHub-flavored syntax plus Streamlit extensions like colored text, badges, Material icons, and LaTeX. Use when formatting text, labels, tooltips, or any text-rendering element.","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fusing-streamlit-markdown\u002FSKILL.md",[181],{"categoryNo":100,"categoryName":101,"taxonomyType":66,"taxonomyTypeDesc":67},[183,20,184,185,186,187,132,188,24,189,190,191,192,193,194,195],"markdown","using streamlit markdown","github","icons","LaTeX","syntax","formatting","element","material","rendering","extensions","features","labels"]