<budget_name>!SET_SPENDING_LIMIT

Set the spending limit for a budget. The spending limit is expressed in number of credits.

See also:

<budget_name>!GET_SPENDING_LIMIT

语法

<budget_name>!SET_SPENDING_LIMIT(<number>)

实参

number

每月分配给预算的 Credit。如果分配给预算的所有对象的总使用量在当月达到此数字,则认为预算达到支出限额的 100%。

For the account budget, all supported objects contribute to the credit usage.

如果未为预算指定值,则预算没有支出限额,永远不会达到 100% 的使用量,并且不会触发通知。

默认值:-1(无支出限额)。

返回

The spending limit has been updated to <n> credits.

访问控制要求

  • 查看 自定义预算 的结果需要以下最低权限和角色:

    • ADMIN instance role for the budget instance.
    • 对包含预算实例的数据库和架构的 USAGE 权限。
  • 需要以下角色才能查看 账户预算 的结果:

    BUDGET_ADMIN application role for the account budget.

For more information, see Budgets roles and privileges.

使用说明

  • The number argument must be a positive integer.
  • 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.

示例

将账户预算的支出限额设置为每月 500 个 Credit:

CALL snowflake.local.account_root_budget!SET_SPENDING_LIMIT(500);

Set the spending limit for budget my_database.my_schema.my_budget to 100 credits per month.

CALL my_database.my_schema.my_budget!SET_SPENDING_LIMIT(100);