Skip to main content

policy_compliance_for_jobs

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

Overview

Namepolicy_compliance_for_jobs
TypeResource
Iddatabricks_workspace.jobs.policy_compliance_for_jobs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
is_compliantboolean
violationsobjectAn object containing key-value mappings representing the first 200 policy validation errors. The keys indicate the path where the policy validation error is occurring. An identifier for the job cluster is prepended to the path. The values indicate an error message describing the policy validation error.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectjob_id, deployment_nameReturns the policy compliance status of a job. Jobs could be out of compliance if a cluster policy
listselectpolicy_id, deployment_namepage_size, page_tokenReturns the policy compliance status of all jobs that use a given policy. Jobs could be out of
enforceinsertdeployment_name, job_idUpdates a job so the job clusters that are created when running the job (specified in new_cluster)

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
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
job_idintegerThe ID of the job whose compliance status you are requesting.
policy_idstringCanonical unique identifier for the cluster policy.
page_sizeintegerUse this field to specify the maximum number of results to be returned by the server. The server may further constrain the maximum number of results returned in a single page.
page_tokenstringA page token that can be used to navigate to the next page or previous page as returned by next_page_token or prev_page_token.

SELECT examples

Returns the policy compliance status of a job. Jobs could be out of compliance if a cluster policy

SELECT
is_compliant,
violations
FROM databricks_workspace.jobs.policy_compliance_for_jobs
WHERE job_id = '{{ job_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Updates a job so the job clusters that are created when running the job (specified in new_cluster)

INSERT INTO databricks_workspace.jobs.policy_compliance_for_jobs (
job_id,
validate_only,
deployment_name
)
SELECT
{{ job_id }} /* required */,
{{ validate_only }},
'{{ deployment_name }}'
RETURNING
has_changes,
job_cluster_changes,
settings
;