Skip to main content

cluster_policies

Operations on a cluster_policies resource.

Overview

Namecluster_policies
TypeResource
Iddatabricks_workspace.compute.cluster_policies

Fields

NameDatatype
namestring
descriptionstring
created_at_timestampinteger
creator_user_namestring
definitionobject
is_defaultboolean
librariesarray
max_clusters_per_userinteger
policy_family_definition_overridesobject
policy_family_idstring
policy_idstring

Methods

NameAccessible byRequired ParamsDescription
getSELECTpolicy_id, deployment_nameGet a cluster policy entity. Creation and editing is available to admins only.
listSELECTdeployment_nameReturns a list of policies accessible by the requesting user.
createINSERTdeployment_nameCreates a new policy with prescribed settings.
deleteDELETEdeployment_nameDelete a policy for a cluster. Clusters governed by this policy can still run, but cannot be edited.
editREPLACEdeployment_nameUpdate an existing policy for cluster. This operation may make some clusters governed by the previous policy invalid.

SELECT examples

SELECT
name,
description,
created_at_timestamp,
creator_user_name,
definition,
is_default,
libraries,
max_clusters_per_user,
policy_family_definition_overrides,
policy_family_id,
policy_id
FROM databricks_workspace.compute.cluster_policies
WHERE deployment_name = '{{ deployment_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new cluster_policies resource.

/*+ create */
INSERT INTO databricks_workspace.compute.cluster_policies (
deployment_name,
data__definition,
data__name
)
SELECT
'{{ deployment_name }}',
'{{ definition }}',
'{{ name }}'
;

REPLACE example

Replaces a cluster_policies resource.

/*+ update */
-- replace field1, field2, etc. with the fields you want to update
REPLACE databricks_workspace.compute.cluster_policies
SET field1 = '{ value1 }',
field2 = '{ value2 }', ...
WHERE deployment_name = '{{ deployment_name }}';

DELETE example

Deletes a cluster_policies resource.

/*+ delete */
DELETE FROM databricks_workspace.compute.cluster_policies
WHERE deployment_name = '{{ deployment_name }}';