创建和使用 Streamlit 应用程序所需的权限¶
Within Streamlit in Snowflake, a Streamlit app is a securable object that adheres to the Snowflake access control framework. Streamlit apps use a permission model that is based on owner's rights. For more information, see 了解所有者的权限和 Streamlit in Snowflake 应用程序. You can also configure a container-runtime app to use restricted caller's rights (Preview). For more information, see 受限制的调用方的权限和 Streamlit in Snowflake.
应用程序所有者和包含 Streamlit 应用程序的架构的所有者可以确定哪些角色有权使用该应用程序。用户可以与应用程序进行交互,并且可以看到 Streamlit 应用程序显示的任何内容。用户与所有者具有相同的应用程序视图,只是他们无法访问编辑模式。
有关更多信息,请参阅 共享 Streamlit 应用程序。
创建 Streamlit 应用程序所需的权限¶
要创建 Streamlit 应用程式,如果您的角色没有下表中的对象,则您的角色必须对这些对象具备列出的 权限:
权限 |
对象 |
备注 |
|---|---|---|
CREATE STREAMLIT |
创建 Streamlit 对象的架构 |
|
READ |
要从中复制 Streamlit 应用程序源文件的暂存区 |
|
USAGE |
Streamlit 应用程序使用的仓库 |
|
USAGE |
Streamlit 应用程序使用的计算池 |
仅当应用程序使用容器运行时时才需要此权限。 |
USAGE |
Streamlit 应用程序使用的外部访问集成 |
仅当您的应用程序使用外部访问集成时,才需要此权限。对于容器运行时,需要此权限才能从外部包索引(如 PyPI)安装包。 |
USAGE |
Streamlit 应用程序使用的密钥 |
仅当应用程序使用密钥时才需要此权限,并且仅适用于仓库运行时。 |
CREATE STAGE |
创建 Streamlit 对象的架构 |
只有使用 ROOT_LOCATION 参数创建 Streamlit 对象时才需要此权限。 |
对架构中的对象进行操作至少需要父数据库的一项权限和父架构的一项权限。
Use the GRANT <privileges> ... TO ROLE command to grant these privileges to a role. The following example shows how to grant the necessary privileges to create container-runtime apps:
如果在数据库或架构上定义了未来授权,请确保用户使用未来授权中定义的角色创建 Streamlit 应用程序。
查看 Streamlit 应用程序所需的权限¶
要查看 Streamlit 应用程序,必须拥有 Snowflake 账户并已登录。此外,您必须使用被授予对以下对象 USAGE 权限的角色:
包含 Streamlit 应用程序的数据库
包含 Streamlit 应用程序的架构
Streamlit 应用程序
在大多数情况下,当应用程序所有者与其他角色共享 Streamlit 应用程序时, USAGE 权限将自动授予新角色。但是,如果在 MANAGED ACCESS 架构中创建 Streamlit 应用程序,则必须手动将 USAGE 权限授予新角色。
架构所有者或具有 MANAGE GRANTS 权限的角色的用户必须使用 GRANT <privileges> ... TO ROLE 命令授予 USAGE 权限,如以下示例所示:
架构所有者或具有 MANAGE GRANTS 权限角色的用户可以授予 USAGE 权限,以查看在架构中创建的所有未来 Streamlit 应用程序,如以下示例所示: