Categories:

System functions (Information)

SYSTEM$SHOW_BUDGETS_FOR_RESOURCE

Returns a string containing a list of the budgets that track a specified resource (for example, a table or a schema).

See also:

<budget_name>!GET_LINKED_RESOURCES

语法

SYSTEM$SHOW_BUDGETS_FOR_RESOURCE( '<resource_domain>' , '<resource_name>' )

实参

'resource_domain'

资源的域。您可以指定以下值中的一个:

  • compute_pool
  • database
  • materialized_view
  • pipe
  • schema
  • table
  • task
  • warehouse
'resource_name'

资源的名称(例如,表的名称)。

返回

返回一个 VARCHAR 值,其中包含资源预算的完全限定名称的逗号分隔列表。该列表置于方括号之间。

If there are no budgets tracking the specified resource, the function returns a string containing an empty pair of square brackets ([]).

使用说明

该函数的输出包含因以下任意原因而涉及该资源的预算:

  • 资源已直接添加到预算中。
  • 资源的标签/值组合已添加到预算中。
  • 资源属于已添加到预算的对象(例如,数据库)。

示例

The following example returns the list of budgets that track the schema named my_db.my_schema:

SELECT SYSTEM$SHOW_BUDGETS_FOR_RESOURCE('SCHEMA', 'my_db.my_schema');
+---------------------------------------------------------------+
| SYSTEM$SHOW_BUDGETS_FOR_RESOURCE('SCHEMA', 'MY_DB.MY_SCHEMA') |
%---------------------------------------------------------------%
| [BUDGETS_DB.BUDGETS_SCHEMA.MY_BUDGET]                         |
+---------------------------------------------------------------+

The following example returns the list of budgets that track the table named my_db.my_schema.my_table. In this example, the table is not tracked by any budget, so the function returns an empty list.

SELECT SYSTEM$SHOW_BUDGETS_FOR_RESOURCE('TABLE', 'my_db.my_schema.my_table');
+-----------------------------------------------------------------------+
| SYSTEM$SHOW_BUDGETS_FOR_RESOURCE('TABLE', 'MY_DB.MY_SCHEMA.MY_TABLE') |
%-----------------------------------------------------------------------%
| []                                                                    |
+-----------------------------------------------------------------------+