某些限制和不支持的功能¶
本主题介绍有关 Streamlit in Snowflake 的以下限制:
不支持的 Streamlit 功能¶
在 Streamlit in Snowflake 中不支持以下 Streamlit 功能:
st.bokeh_chart (https://docs.streamlit.io/1.39.0/develop/api-reference/charts/st.bokeh_chart)
st.camera_input (https://docs.streamlit.io/1.39.0/develop/api-reference/widgets/st.camera_input)
st.feedback (https://docs.streamlit.io/1.39.0/develop/api-reference/widgets/st.feedback)
st.file_uploader (https://docs.streamlit.io/1.39.0/develop/api-reference/widgets/st.file_uploader)
st.set_page_config (https://docs.streamlit.io/1.39.0/develop/api-reference/configuration/st.set_page_config)
不支持
st.set_page_config
命令的page_title
、page_icon
和menu_items
属性。st.experimental_audio_input (https://docs.streamlit.io/1.39.0/develop/api-reference/widgets/st.audio_input)
st.experimental_get_query_params (https://docs.streamlit.io/1.39.0/develop/api-reference/caching-and-state/st.experimental_get_query_params)
st.experimental_set_query_params (https://docs.streamlit.io/1.39.0/develop/api-reference/caching-and-state/st.experimental_set_query_params)
st.components.v1.iframe (https://docs.streamlit.io/1.39.0/develop/api-reference/custom-components/st.components.v1.iframe)
st.components.v1.declare_component (https://docs.streamlit.io/1.39.0/develop/api-reference/custom-components/st.components.v1.declare_component)
锚定链接
Markdown (https://docs.streamlit.io/1.39.0/develop/api-reference/text/st.markdown) 中的资料图标
在 Streamlit in Snowflake 中加载外部资源时的限制¶
所有 Streamlit in Snowflake 应用程序均在符合 内容安全策略 (CSP) (https://content-security-policy.com/) 的条件下运行,该策略限制可以加载哪些资源。Snowflake 阻止从任何外部域加载代码,包括脚本、样式、字体和 iframe 嵌入。但支持从 Mapbox 加载资源子集。
使用 ` st.map <https://docs.streamlit.io/develop/api-reference/charts/st.map (https://docs.streamlit.io/develop/api-reference/charts/st.map)>`_ 或 st.pydeck_chart (https://docs.streamlit.io/develop/api-reference/charts/st.pydeck_chart) Streamlit 命令时,Mapbox 会在渲染地图内容时提供地图图块。Mapbox 是第三方应用程序,受Snowflake的 外部产品条款 的约束。
Streamlit in Snowflake 支持从外部域加载图像或媒体,但 Snowflake Native App Framework 不支持。
例如,以下代码运行时没有 Python 错误,但不会在浏览器中加载或执行脚本:
# This will not work
import streamlit.components.v1 as components
components.html("""
<script src="http://www.example.com/example.js"></script>
""", height=0)
CSP 还会阻止通常被认为不安全的前端调用,例如 eval()
。
备注
根据 Snowflake 责任共担模式,应用程序开发人员负责安全检查和 Streamlit in Snowflake 应用程序代码的软件供应链。
其他 Streamlit in Snowflake 限制¶
Streamlit in Snowflake 有下列额外限制:
不支持使用外部暂存区。
不支持副本。
不支持使用 .so 文件。
Streamlit 应用程序对检索数据有限制¶
在 Streamlit in Snowflake 和 Snowflake Native App 中运行的 Streamlit 应用程序对后端和前端间交换的消息大小有 32 MB 的限制。超过 32 MB 的查询将返回以下错误:
MessageSizeError: Data Size exceeds message limit
要避免此限制,请将 Streamlit 应用程序设计为以小于 32 MB 的增量检索数据。
Streamlit in Snowflake 编辑器不支持具有服务器端加密的暂存区¶
Streamlit in Snowflake 编辑器不支持从使用服务器端加密的命名暂存区上的文件 创建 STREAMLIT 对象。在这种情况下, Snowsight 会返回错误。
Streamlit in Snowflake 仅支持使用客户端加密的内部暂存区。
st.cache_data
和 st.cache_resource
尚未得到全面支持¶
在 Streamlit in Snowflake 中,st.cache_data (https://docs.streamlit.io/library/api-reference/performance/st.cache_data) 和 st.cache_resource (https://docs.streamlit.io/library/api-reference/performance/st.cache_resource) 尚未得到完全支持。缓存仅在单个会话中有效。缓存值不能转移到其他会话,也不能在 Streamlit 应用程序的不同用户之间共享。
支持多页 Streamlit 应用程序,但需注意一些事项¶
支持多页面 Streamlit 应用程序,但需要注意以下事项:
只能使用 SQL 命令创建多页面 Streamlit 应用程序。请参阅 使用 SQL 创建和部署 Streamlit 应用程序。
不支持单个页面 URLs。
上传到
/pages
目录的文件在命名暂存区的 ROOT_LOCATION 中可见。