<budget_ name>!ADD_ SHARED_ RESOURCE¶
Adds a shared resource to a custom budget. When you add a shared resource, consumption is tracked only if the resource is used by certain users. These users are tagged with a tag-value pair that was added to the budget using the SET_USER_TAGS method.
For more information, see Using budgets for AI features (shared resources).
语法
实参
'domain'添加到预算的资源类型。有效值:模型监视器名称字符串。
AI FUNCTIONCORTEX CODECORTEX AGENTSNOWFLAKE INTELLIGENCE
除非指定第二个实参,否则预算将跟踪指定域内所有资源的使用情况。
'instance'Optional. Specifies a specific resource within the selected
domainto add to the budget.For domains that support instance-level selection (such as
AI FUNCTIONandCORTEX CODE), this argument allows you to track a specific function or interface.如果不指定第二个实参,预算将跟踪域内的所有实例。
示例:
- AI Functions:
AI_CLASSIFY,AI_COMPLETE - Cortex Code:
CORTEX_CODE_CLI,CORTEX_CODE_SNOWSIGHT
Instance-level selection is not applicable to all domains. For example,
CORTEX AGENTandSNOWFLAKE INTELLIGENCEare currently tracked at the domain level only.- AI Functions:
返回
返回一个 VARCHAR 值,用于指明资源是否已成功添加到预算中。
如果资源无法添加到预算,函数会返回错误消息。
访问控制要求
要为自定义预算调用此方法,需要具备以下权限和角色:
- ADMIN instance role for the budget instance.
- 对包含预算实例的数据库和架构的 USAGE 权限。
- 对包含该被添加资源的数据库和架构的 USAGE 权限(对于架构对象)。
For more information, see Budgets roles and privileges.
使用说明
- 您只能将共享资源添加到 自定义预算。
- To verify the results of the method, call the GET_BUDGET_SCOPE method.
- 当指定实体类型的所有对象都被添加后(例如所有 AI 函数),您就无法再添加该类型的单个资源了。
-
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.
示例
将全部 AI 函数添加到预算:
将特定 AI 函数添加到预算:
将所有 Cortex Code 工作负载添加到预算:
将 Cortex Code CLI 工作负载添加到预算:
将 Cortex Code Snowsight 工作负载添加到预算:
将 Cortex Agent 工作负载添加到预算:
Note
Cortex Agent budgets are available at the domain level only. To track the cost of specific agents, use resource budgets through resource tags instead. For more information, see Resource budgets for Cortex Agents.
将所有 Snowflake Intelligence 工作负载添加到预算:
Note
Snowflake Intelligence 预算仅在域级别可用。