budgets
Creates, updates, deletes, gets or lists a budgets resource.
Overview​
| Name | budgets |
| Type | Resource |
| Id | databricks_account.billing.budgets |
Fields​
The following fields are returned by SELECT queries:
- budgets_get
- budgets_list
| Name | Datatype | Description |
|---|---|---|
account_id | string | |
budget_configuration_id | string | Databricks budget configuration ID. |
display_name | string | Human-readable name of budget configuration. Max Length: 128 |
alert_configurations | array | Alerts to configure when this budget is in a triggered state. Budgets must have at least one alert configuration. A budget can have up to four shared alerts per time period, each with a unique ``quantity_threshold``. Budgets with ``resource_type`` set to ``BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY`` can also use per-user alerts, with optional ``principal_overrides``. These budgets can have at most one per-user alert per time period, and can use shared alerts, a per-user alert, or both. The ``BLOCK_USAGE`` action is only supported on budgets with ``resource_type`` set to ``BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY``. At most one shared alert per time period can have a ``BLOCK_USAGE`` action, and it must be the shared alert with the highest threshold in that period. |
create_time | integer | Creation time of this budget configuration. |
filter | object | Configured filters for this budget. These are applied to your account's usage to limit the scope of what is considered for this budget. Leave empty to include all usage for this account. All provided filters must be matched for usage to be included. |
include_external_spend | boolean | Whether this budget tracks external pass-through spend (third-party costs billed through a Databricks product) in addition to internal Databricks spend. Only applicable to Unity Gateway budgets, i.e. when ``resource_type`` is ``BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY``. This field is immutable after create. |
resource_type | string | The resource scope for this budget. Determines whether the budget tracks all resources or a specific resource. (BUDGET_RESOURCE_TYPE_ALL_RESOURCES, BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY) |
update_time | integer | Update time of this budget configuration. |
| Name | Datatype | Description |
|---|---|---|
account_id | string | |
budget_configuration_id | string | Databricks budget configuration ID. |
display_name | string | Human-readable name of budget configuration. Max Length: 128 |
alert_configurations | array | Alerts to configure when this budget is in a triggered state. Budgets must have at least one alert configuration. A budget can have up to four shared alerts per time period, each with a unique ``quantity_threshold``. Budgets with ``resource_type`` set to ``BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY`` can also use per-user alerts, with optional ``principal_overrides``. These budgets can have at most one per-user alert per time period, and can use shared alerts, a per-user alert, or both. The ``BLOCK_USAGE`` action is only supported on budgets with ``resource_type`` set to ``BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY``. At most one shared alert per time period can have a ``BLOCK_USAGE`` action, and it must be the shared alert with the highest threshold in that period. |
create_time | integer | Creation time of this budget configuration. |
filter | object | Configured filters for this budget. These are applied to your account's usage to limit the scope of what is considered for this budget. Leave empty to include all usage for this account. All provided filters must be matched for usage to be included. |
include_external_spend | boolean | Whether this budget tracks external pass-through spend (third-party costs billed through a Databricks product) in addition to internal Databricks spend. Only applicable to Unity Gateway budgets, i.e. when ``resource_type`` is ``BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY``. This field is immutable after create. |
resource_type | string | The resource scope for this budget. Determines whether the budget tracks all resources or a specific resource. (BUDGET_RESOURCE_TYPE_ALL_RESOURCES, BUDGET_RESOURCE_TYPE_UNITY_AI_GATEWAY) |
update_time | integer | Update time of this budget configuration. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
budgets_get | select | account_id, budget_id, account_host | Gets a budget configuration for an account. Both account and budget configuration are specified by ID. | |
budgets_list | select | account_id, account_host | page_token | Gets all budgets associated with this account. |
budgets_create | insert | account_id, account_host, budget | Create a new budget configuration for an account. For full details, see | |
budgets_update | replace | account_id, budget_id, account_host, budget | Updates a budget configuration for an account. Both account and budget configuration are specified by | |
budgets_delete | delete | account_id, budget_id, account_host | Deletes a budget configuration for an account. Both account and budget configuration are specified by |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
account_host | string | The Databricks account console host. Selected by DATABRICKS_CLOUD (aws, azure or gcp; default aws), or set explicitly with DATABRICKS_ACCOUNT_HOST (bare host, no scheme). (default: accounts.cloud.databricks.com, x-stackQL-envVar: DATABRICKS_ACCOUNT_HOST, x-stackQL-envVarSelector: {"envVar":"DATABRICKS_CLOUD","default":"aws","values":{"aws":"accounts.cloud.databricks.com","azure":"accounts.azuredatabricks.net","gcp":"accounts.gcp.databricks.com"}}) |
account_id | string | |
budget_id | string | The Databricks budget configuration ID. |
page_token | string | A page token received from a previous get all budget configurations call. This token can be used to retrieve the subsequent page. Requests first page if absent. |
SELECT examples​
- budgets_get
- budgets_list
Gets a budget configuration for an account. Both account and budget configuration are specified by ID.
SELECT
account_id,
budget_configuration_id,
display_name,
alert_configurations,
create_time,
filter,
include_external_spend,
resource_type,
update_time
FROM databricks_account.billing.budgets
WHERE account_id = '{{ account_id }}' -- required
AND budget_id = '{{ budget_id }}' -- required
AND account_host = '{{ account_host }}' -- required
;
Gets all budgets associated with this account.
SELECT
account_id,
budget_configuration_id,
display_name,
alert_configurations,
create_time,
filter,
include_external_spend,
resource_type,
update_time
FROM databricks_account.billing.budgets
WHERE account_id = '{{ account_id }}' -- required
AND account_host = '{{ account_host }}' -- required
AND page_token = '{{ page_token }}'
;
INSERT examples​
- budgets_create
- Manifest
Create a new budget configuration for an account. For full details, see
INSERT INTO databricks_account.billing.budgets (
budget,
account_id,
account_host
)
SELECT
'{{ budget }}' /* required */,
'{{ account_id }}',
'{{ account_host }}'
RETURNING
budget
;
# Description fields are for documentation purposes
- name: budgets
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the budgets resource.
- name: account_host
value: "{{ account_host }}"
description: Required parameter for the budgets resource.
- name: budget
description: |
Properties of the new budget configuration.
value:
account_id: "{{ account_id }}"
alert_configurations:
- action_configurations: "{{ action_configurations }}"
principal_overrides: "{{ principal_overrides }}"
quantity_threshold: "{{ quantity_threshold }}"
quantity_type: "{{ quantity_type }}"
scope_type: "{{ scope_type }}"
time_period: "{{ time_period }}"
trigger_type: "{{ trigger_type }}"
display_name: "{{ display_name }}"
filter:
tags:
- key: "{{ key }}"
value:
operator: "{{ operator }}"
values:
- "{{ values }}"
workspace_id:
operator: "{{ operator }}"
values:
- {{ values }}
include_external_spend: {{ include_external_spend }}
resource_type: "{{ resource_type }}"
REPLACE examples​
- budgets_update
Updates a budget configuration for an account. Both account and budget configuration are specified by
REPLACE databricks_account.billing.budgets
SET
budget = '{{ budget }}'
WHERE
account_id = '{{ account_id }}' --required
AND budget_id = '{{ budget_id }}' --required
AND account_host = '{{ account_host }}' --required
AND budget = '{{ budget }}' --required
RETURNING
budget;
DELETE examples​
- budgets_delete
Deletes a budget configuration for an account. Both account and budget configuration are specified by
DELETE FROM databricks_account.billing.budgets
WHERE account_id = '{{ account_id }}' --required
AND budget_id = '{{ budget_id }}' --required
AND account_host = '{{ account_host }}' --required
;