Skip to main content

budget_policy

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

Overview

Namebudget_policy
TypeResource
Iddatabricks_account.billing.budget_policy

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
policy_idstringThe Id of the policy. This field is generated by Databricks and globally unique.
policy_namestringThe name of the policy. - Must be unique among active policies. - Can contain only characters from the ISO 8859-1 (latin1) set. - Can't start with reserved keywords such as `databricks:default-policy`.
binding_workspace_idsarrayList of workspaces that this budget policy will be exclusively bound to. An empty binding implies that this budget policy is open to any workspace in the account.
custom_tagsstringA list of tags defined by the customer. At most 20 entries are allowed per policy.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
budget_policy_getselectaccount_id, policy_idRetrieves a policy by it's ID.
budget_policy_listselectaccount_idfilter_by, page_size, page_token, sort_specLists all policies. Policies are returned in the alphabetically ascending order of their names.
budget_policy_createinsertaccount_idCreates a new policy.
budget_policy_updateupdateaccount_id, policy_id, policylimit_configUpdates a policy
budget_policy_deletedeleteaccount_id, policy_idDeletes a policy

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_idstring
policy_idstringThe Id of the policy.
filter_byobjectA filter to apply to the list of policies.
limit_configobjectDEPRECATED. This is redundant field as LimitConfig is part of the BudgetPolicy
page_sizeintegerThe maximum number of budget policies to return. If unspecified, at most 100 budget policies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
page_tokenstringA page token, received from a previous ListServerlessPolicies call. Provide this to retrieve the subsequent page. If unspecified, the first page will be returned. When paginating, all other parameters provided to ListServerlessPoliciesRequest must match the call that provided the page token.
sort_specobjectThe sort specification.

SELECT examples

Retrieves a policy by it's ID.

SELECT
policy_id,
policy_name,
binding_workspace_ids,
custom_tags
FROM databricks_account.billing.budget_policy
WHERE account_id = '{{ account_id }}' -- required
AND policy_id = '{{ policy_id }}' -- required
;

INSERT examples

Creates a new policy.

INSERT INTO databricks_account.billing.budget_policy (
policy,
request_id,
account_id
)
SELECT
'{{ policy }}',
'{{ request_id }}',
'{{ account_id }}'
RETURNING
policy_id,
policy_name,
binding_workspace_ids,
custom_tags
;

UPDATE examples

Updates a policy

UPDATE databricks_account.billing.budget_policy
SET
policy = '{{ policy }}'
WHERE
account_id = '{{ account_id }}' --required
AND policy_id = '{{ policy_id }}' --required
AND policy = '{{ policy }}' --required
AND limit_config = '{{ limit_config}}'
RETURNING
policy_id,
policy_name,
binding_workspace_ids,
custom_tags;

DELETE examples

Deletes a policy

DELETE FROM databricks_account.billing.budget_policy
WHERE account_id = '{{ account_id }}' --required
AND policy_id = '{{ policy_id }}' --required
;