Skip to main content

usage_policy

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

Overview

Nameusage_policy
TypeResource
Iddatabricks_account.billing.usage_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.
binding_workspace_idsarrayList of workspaces that this usage policy will be exclusively bound to.
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
usage_policy_getselectaccount_id, policy_idRetrieves a usage policy by it's ID.
usage_policy_listselectaccount_idfilter_by, page_size, page_token, sort_specLists all usage policies. Policies are returned in the alphabetically ascending order of their names.
usage_policy_createinsertaccount_idCreates a new usage policy.
usage_policy_updateupdateaccount_id, policy_id, policylimit_configUpdates a usage policy
usage_policy_deletedeleteaccount_id, policy_idDeletes a usage 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 UsagePolicy
page_sizeintegerThe maximum number of usage policies to return.
page_tokenstringA page token, received from a previous ListUsagePolicies call.
sort_specobjectThe sort specification.

SELECT examples

Retrieves a usage policy by it's ID.

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

INSERT examples

Creates a new usage policy.

INSERT INTO databricks_account.billing.usage_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 usage policy

UPDATE databricks_account.billing.usage_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 usage policy

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