<budget_ name>!GET_ BUDGET_ SCOPE¶
Returns the resources and tags that have been added to a custom budget. Helps determine which resource consumption is tracked by the budget.
The list does not include:
- Objects that were added automatically (for example, compute pools and warehouses created and owned by a Snowflake Native App).
- Objects that were added when a tag was added to the budget.
语法
返回
该方法返回一个具有以下键的 JSON 对象:
resource_tags已添加到预算的资源标签。如果资源带有这些标签,则属于预算。包含以下字段:
operator用于资源标签的匹配逻辑。可以是以下值之一:
UNION: A resource is included in the budget if it is tagged with any of the tag-value pairs in thetagsarray.INTERSECTION: A resource must be tagged with all of the tag-value pairs in thetagsarray to be included in the budget.
tags标签对象数组,每个标签对象都包含以下字段:
tagId标签的内部标识符。
tagDatabase包含标签的数据库。
tagSchema包含标签的架构。
tagName标签的名称。
tagValues与标签关联的标签值数组。
resources已直接添加到预算的资源数组。各对象包含以下字段:
resourceId资源的内部标识符。
resourceName资源的名称。
resourceDomainDomain of the resource (for example,
WAREHOUSE,DATABASE,TABLE).schemaName包含资源的架构。
databaseName包含资源的数据库。
访问控制要求
查看自定义预算的结果需要以下最低权限和角色:
- ADMIN instance role for the budget instance.
- 对包含预算实例的数据库和架构的 USAGE 权限。
For more information, see Budgets roles and privileges.
使用说明
- 此方法只能在 自定义预算 实例上调用。
-
Calling this method does not return the object. Because of this, you can’t use method chaining to call another method on the return value of this method. Instead, call each method in a separate SQL statement.
示例
Get all resources and tags that have been added to the budget_db.budget_schema.my_budget budget: