global_init_scripts
Creates, updates, deletes, gets or lists a global_init_scripts resource.
Overview
| Name | global_init_scripts |
| Type | Resource |
| Id | databricks_workspace.compute.global_init_scripts |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the script |
script_id | string | The global init script ID. |
created_at | integer | |
created_by | string | The username of the user who created the script. |
enabled | boolean | Specifies whether the script is enabled. The script runs only if enabled. |
position | integer | The position of a script, where 0 represents the first script to run, 1 is the second script to run, in ascending order. |
script | string | The Base64-encoded content of the script. |
updated_at | integer | Time when the script was updated, represented as a Unix timestamp in milliseconds. |
updated_by | string | The username of the user who last updated the script |
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the script |
script_id | string | The global init script ID. |
created_at | integer | |
created_by | string | The username of the user who created the script. |
enabled | boolean | Specifies whether the script is enabled. The script runs only if enabled. |
position | integer | The position of a script, where 0 represents the first script to run, 1 is the second script to run, in ascending order. |
updated_at | integer | Time when the script was updated, represented as a Unix timestamp in milliseconds. |
updated_by | string | The username of the user who last updated the script |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | script_id, deployment_name | Gets all the details of a script, including its Base64-encoded contents. | |
list | select | deployment_name | Get a list of all global init scripts for this workspace. This returns all properties for each script | |
create | insert | deployment_name, name, script | Creates a new global init script in this workspace. | |
update | update | script_id, deployment_name, name, script | Updates a global init script, specifying only the fields to change. All fields are optional. | |
delete | delete | script_id, deployment_name | Deletes a global init script. |
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.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
script_id | string | The ID of the global init script. |
SELECT examples
- get
- list
Gets all the details of a script, including its Base64-encoded contents.
SELECT
name,
script_id,
created_at,
created_by,
enabled,
position,
script,
updated_at,
updated_by
FROM databricks_workspace.compute.global_init_scripts
WHERE script_id = '{{ script_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;
Get a list of all global init scripts for this workspace. This returns all properties for each script
SELECT
name,
script_id,
created_at,
created_by,
enabled,
position,
updated_at,
updated_by
FROM databricks_workspace.compute.global_init_scripts
WHERE deployment_name = '{{ deployment_name }}' -- required
;
INSERT examples
- create
- Manifest
Creates a new global init script in this workspace.
INSERT INTO databricks_workspace.compute.global_init_scripts (
name,
script,
enabled,
position,
deployment_name
)
SELECT
'{{ name }}' /* required */,
'{{ script }}' /* required */,
{{ enabled }},
{{ position }},
'{{ deployment_name }}'
RETURNING
script_id
;
# Description fields are for documentation purposes
- name: global_init_scripts
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the global_init_scripts resource.
- name: name
value: "{{ name }}"
description: |
The name of the script
- name: script
value: "{{ script }}"
description: |
The Base64-encoded content of the script.
- name: enabled
value: {{ enabled }}
description: |
Specifies whether the script is enabled. The script runs only if enabled.
- name: position
value: {{ position }}
description: |
The position of a global init script, where 0 represents the first script to run, 1 is the second script to run, in ascending order. If you omit the numeric position for a new global init script, it defaults to last position. It will run after all current scripts. Setting any value greater than the position of the last script is equivalent to the last position. Example: Take three existing scripts with positions 0, 1, and 2. Any position of (3) or greater puts the script in the last position. If an explicit position value conflicts with an existing script value, your request succeeds, but the original script at that position and all later scripts have their positions incremented by 1.
UPDATE examples
- update
Updates a global init script, specifying only the fields to change. All fields are optional.
UPDATE databricks_workspace.compute.global_init_scripts
SET
name = '{{ name }}',
script = '{{ script }}',
enabled = {{ enabled }},
position = {{ position }}
WHERE
script_id = '{{ script_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND name = '{{ name }}' --required
AND script = '{{ script }}' --required;
DELETE examples
- delete
Deletes a global init script.
DELETE FROM databricks_workspace.compute.global_init_scripts
WHERE script_id = '{{ script_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;