管理应用程序
This topic describes how to manage a Snowflake Native App after it is installed in a consumer account.
查看已安装的 Snowflake Native Apps 和 Streamlit 应用程序¶
-
Sign in to Snowsight.
-
In the navigation menu, select Catalog » Apps.
A list of installed applications and Streamlit apps appears in the Installed Apps list.
查看应用程序的自述文件
- Sign in to Snowsight.
- In the navigation menu, select Catalog » Apps.
- 选择应用程序。
- Select the Settings icon in the toolbar.
- Select the About the app tab.
将应用程序角色授予账户角色
- Sign in to Snowsight.
- In the navigation menu, select Catalog » Apps.
- 选择应用程序。
- Select the Settings icon in the toolbar.
- Select the Access management tab.
- In the Account roles with access pane select Add.
- Select a role in the Account roles list.
- Select Close.
使用 SQL 命令,将应用程序角色授予账户角色¶
要使用 SQL 命令将应用程序角色授予使用者账户中的账户角色,请使用 GRANT DATABASE ROLE 的 GRANT APPLICATION ROLE 命令,如下例所示:
启动应用程序
- Sign in to Snowsight.
- In the navigation menu, select Catalog » Apps.
- 选择应用程序。
- Select the Settings icon in the toolbar.
- Click Launch App.
使用自定义预算来监控应用程序的 credit 使用情况¶
Budgets allow you to define a monthly spending limit on the compute costs for an app. You can create and configure a custom budget to monitor the credit usage for the objects owned by the app that consume credits.
当您将应用程序添加到自定义预算时,应用程序所有且使用 credit 的对象会自动添加到自定义预算。其中包括应用程序拥有的仓库和计算池。
自定义预算不会自动跟踪 共享 仓库和计算池,但是您可以手动将其添加到自定义预算。为应用程序创建自定义预算时,您不能将应用程序创建和拥有的对象添加到单独的自定义预算。但是,您可以将共享的仓库和计算池添加到单独的自定义预算。
设置所需角色,为应用程序创建自定义预算
To create or edit a custom budget for an app, you must use a role that has the correct privileges. See Custom budgets.
Create a custom budget for an app in Snowsight¶
You can create or edit a custom budget for an app directly from the app configuration page. You can also do it from the Budgets tab in Snowsight (see Use Snowsight to create a custom budget).
要从应用程序配置页面为应用程序创建自定义预算,请执行以下步骤:
- Sign in to Snowsight.
- In the navigation menu, select Catalog » Apps.
- 选择您想要查看其自定义预算的应用程序。
- Select the Cost management tab.
- Select Create Budget.
- Select Budget.
- Enter a Budget name.
- 选择要在其中创建预算的数据库和架构。
- Enter the Spending limit.
- 输入用于接收通知的电子邮件地址。
Note
Each email address added for custom budget notifications must be verified. The notification email setup fails if any email address in the list is not verified.
- Select Resources to monitor.
- 选择要添加到自定义预算的应用程序。
- To add an app, expand Native Apps to select an app.
- To add a database, expand Databases to select a database.
- To add objects in a schema, expand the schema to list available objects. Expand the object category (for example, Tables or Tasks) to select objects.
- To add a warehouse, expand Warehouses to select a warehouse.
- To add a compute pool, expand Compute Pools to select a compute pool.
Note
- When you select a database or schema, all supported objects (for example, tables) contained within the database or schema are also added to the custom budget.
- You can only add an object to one custom budget. If an object is currently included in one custom budget and you add that object to a second custom budget, Snowflake removes the object from the first custom budget without issuing a warning.
使用 SQL 为应用程序创建自定义预算¶
To create a custom budget for an app by using SQL, see Use SQL commands to create a custom budget.
监控应用程序
默认情况下,应用程序所有者可使用不同的 SQL 命令查看使用者账户中应用程序的相关信息。要允许使用者账户中的其他角色使用这些命令,您可以将 MONITOR 权限授予另一个角色。
您还可以将应用程序的 MONITOR 权限授予另一个应用程序,如以下示例所示:
MONITOR 权限允许角色运行以下命令:
应用程序不可用时怎么办
To check the status of an app, run the
SHOW APPLICATIONS command and determine the
upgrade_status value. When an app is unavailable, the
DESCRIBE APPLICATION command
fails and the error message provides information about why the app is unavailable.
下表列出了应用程序不可用的原因及问题解决方法:
| 原因 | 可能的解决方案 |
|---|---|
| Snowflake 禁用了该应用程序。 | Contact Snowflake Support |
| 使用者账户被锁定或暂停后处于不活动状态。 | 账户恢复后,应用程序将重新启用。 |
| 应用程序的版本已从提供商账户的应用程序包中删除。 | 在这种情况下,应用程序将不再可用,必须卸载并通过当前列表重新安装。 |
| The consumer exceeded the usage limit for a usage based trial. | See Trial a listing for possible options. |
| 该应用程序是通过付费列表安装的,但未提供付款信息或付款信息不是最新。 | Pay for the listing. See Pay for listings for more information. |
| 已超过列表的试用期。 | 联系应用程序提供商。 |
Uninstall a Snowflake Native App¶
You can uninstall an app using Snowsight or by running SQL commands.
To uninstall an app, you must use a role that has the OWNERSHIP privilege on the app. See GRANT OWNERSHIP.
To transfer ownership of objects owned by the app that exist outside the app, you must use a role that has the MANAGE GRANTS privilege on the objects. See Access control considerations.
Uninstall an app in Snowsight¶
- Sign in to Snowsight.
- In the navigation menu, select Catalog » Apps.
- Next to the app, select …, then select Uninstall.
如果应用程序创建的对象存在于应用程序之外,则会出现一个对话框,显示对象及其所属类型的列表。
- 选择以下选项之一:
- Yes, transfer selected objects to a role.
如果选择此选项,请从列表中选择一个角色。该角色将成为对象的新所有者。
Caution
When using Snowsight, only the following objects owned by the Snowflake Native App can be transferred to a different role:
- 数据库
- 架构
- 表
- 视图
- No, delete all objects created outside the app.
如果选择此选项,则卸载应用程序时将删除对象。
- Select Uninstall.
使用 SQL 命令卸载应用程序¶
-
Use the
SHOW OBJECTS OWNED BY APPLICATIONcommand to view the objects owned by the Snowflake Native App that exist outside the app as shown in the following example:
该命令显示对象及其所属类型的列表。
-
Optionally, to transfer ownership of an object to a different role, use the GRANT OWNERSHIP command as shown in the following example.
-
To delete the app, run the DROP APPLICATION command as shown in the following example:
Note
If you do not transfer ownership of the objects owned by the app to a different role, you must used the
CASCADEoption. If objects owned by the app still exist you can’t drop the app without using theCASCADEoption.