global_init_scripts
Operations on a global_init_scripts
resource.
Overview
Name | global_init_scripts |
Type | Resource |
Id | databricks_workspace.compute.global_init_scripts |
Fields
Name | Datatype |
---|---|
name | string |
created_at | integer |
created_by | string |
enabled | boolean |
position | integer |
script | string |
script_id | string |
updated_at | integer |
updated_by | string |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | script_id, deployment_name | Manage a specific global init script with ID |
list | SELECT | deployment_name | Manages global init scripts for this workspace. |
create | INSERT | deployment_name | Manages global init scripts for this workspace. |
delete | DELETE | script_id, deployment_name | Manage a specific global init script with ID |
update | UPDATE | script_id, deployment_name | Manage a specific global init script with ID |
SELECT
examples
- global_init_scripts (list)
- global_init_scripts (get)
SELECT
name,
created_at,
created_by,
enabled,
position,
script,
script_id,
updated_at,
updated_by
FROM databricks_workspace.compute.global_init_scripts
WHERE deployment_name = '{{ deployment_name }}';
SELECT
name,
created_at,
created_by,
enabled,
position,
script,
script_id,
updated_at,
updated_by
FROM databricks_workspace.compute.global_init_scripts
WHERE script_id = '{{ script_id }}' AND
deployment_name = '{{ deployment_name }}';
INSERT
example
Use the following StackQL query and manifest file to create a new global_init_scripts
resource.
- global_init_scripts
- Manifest
/*+ create */
INSERT INTO databricks_workspace.compute.global_init_scripts (
deployment_name,
data__name,
data__script,
data__position,
data__enabled
)
SELECT
'{{ deployment_name }}',
'{{ name }}',
'{{ script }}',
'{{ position }}',
'{{ enabled }}'
;
- name: your_resource_model_name
props:
- name: name
value: My example script name
- name: script
value: ZWNobyBoZWxsbw==
- name: position
value: 0
- name: enabled
value: false
UPDATE
example
Updates a global_init_scripts
resource.
/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.compute.global_init_scripts
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE script_id = '{{ script_id }}' AND
deployment_name = '{{ deployment_name }}';
DELETE
example
Deletes a global_init_scripts
resource.
/*+ delete */
DELETE FROM databricks_workspace.compute.global_init_scripts
WHERE script_id = '{{ script_id }}' AND
deployment_name = '{{ deployment_name }}';