Seeking Workarounds for Unsupported Streamlit Features in Snowflake Environment

Hello Streamlit Community,

I’ve been working on integrating Streamlit with Snowflake to leverage its powerful data warehousing capabilities for a web application. However, I’ve encountered several challenges due to unsupported features within the Snowflake environment. I’m reaching out to see if anyone has found workarounds or alternative solutions for these issues. The features in question are:

  • st.cache_data

  • st.cache_resource

  • st.experimental_set_query_params

  • st.experimental_get_query_params

  • Using unsafe HTML with unsafe_allow_html=True in st.markdown

  • Context:

I’m developing a Streamlit app that connects to a Snowflake database. The app is intended to provide interactive data visualizations and analytics capabilities to end-users. My setup involves using Streamlit’s caching mechanisms to optimize performance and using query parameters for dynamic content generation. Additionally, I need to render custom HTML for specific UI enhancements using streamlit_aggrid

  • Challenges:

Upon integrating Streamlit with Snowflake, I discovered that the aforementioned features are not supported in the Snowflake environment. This limitation significantly impacts the app’s functionality and user experience.

  • The caching features (st.cache_data and st.cache_resource) are crucial for performance optimization, especially when dealing with large datasets.

  • The experimental query parameters (st.experimental_set_query_params and st.experimental_get_query_params) are essential for creating dynamic, user-driven content.

  • The inability to use unsafe HTML (unsafe_allow_html=True) in st.markdown restricts the customization of the app’s UI.

  • Seeking Guidance:

Has anyone encountered similar limitations while working with Streamlit in Snowflake? If so, how did you address these challenges?

Are there any workarounds or alternative approaches that you can recommend? I’m particularly interested in any creative solutions that allow for caching, dynamic content generation, and UI customization within the constraints of the Snowflake environment.

I appreciate any insights, suggestions, or experiences you can share. Your help could significantly impact the success of this project and potentially benefit others facing similar challenges.

Thank you in advance for your support and collaboration!

As altenantives to streamlit cache you can use functools.lru_cache or just module level variables (in modules other than the main script).

Besides, would connecting to snowflake from an app hosted somewhere else work?

I will try functors.lru_cache and see if it works and respond based on how it goes.

We are connecting to snowflake from a streamlit application hosted somewhere else. We would like to host the streamlit application in snowflake itself, that’s the reason I reached out.

But thanks nonetheless.