Skip to main content

budgets

Creates, updates, deletes, gets or lists a budgets resource.

Overview​

Namebudgets
TypeResource
Iddatabricks_account.billing.budgets

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
account_idstring
budget_configuration_idstringDatabricks budget configuration ID.
display_namestringHuman-readable name of budget configuration. Max Length: 128
â–¶alert_configurationsarrayAlerts 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_timeintegerCreation time of this budget configuration.
â–¶filterobjectConfigured 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_spendbooleanWhether 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_typestringThe 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_timeintegerUpdate time of this budget configuration.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
budgets_getselectaccount_id, budget_id, account_hostGets a budget configuration for an account. Both account and budget configuration are specified by ID.
budgets_listselectaccount_id, account_hostpage_tokenGets all budgets associated with this account.
budgets_createinsertaccount_id, account_host, budgetCreate a new budget configuration for an account. For full details, see
budgets_updatereplaceaccount_id, budget_id, account_host, budgetUpdates a budget configuration for an account. Both account and budget configuration are specified by
budgets_deletedeleteaccount_id, budget_id, account_hostDeletes 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.

NameDatatypeDescription
account_hoststringThe 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_idstring
budget_idstringThe Databricks budget configuration ID.
page_tokenstringA 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​

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
;

INSERT examples​

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
;

REPLACE examples​

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​

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
;