Skip to main content

commands

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

Overview

Namecommands
TypeResource
Iddatabricks_workspace.compute.commands

Fields

The following fields are returned by SELECT queries:

Status was returned successfully.

NameDatatypeDescription
idstring
resultsobject
statusstring

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
commandstatusselectdeployment_nameGets the status of and, if available, the results from a currently executing command.
createinsertdeployment_nameCreates an execution context for running cluster commands.
cancelexecdeployment_nameCancels a currently running command within an execution context.
destroyexecdeployment_nameDeletes an execution context.
executeexecdeployment_nameRuns a cluster command in the given execution context, using the provided language.

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)

SELECT examples

Gets the status of and, if available, the results from a currently executing command.

SELECT
id,
results,
status
FROM databricks_workspace.compute.commands
WHERE deployment_name = '{{ deployment_name }}' -- required;

INSERT examples

Creates an execution context for running cluster commands.

INSERT INTO databricks_workspace.compute.commands (
data__clusterId,
data__language,
deployment_name
)
SELECT
'{{ clusterId }}',
'{{ language }}',
'{{ deployment_name }}'
RETURNING
id
;

Lifecycle Methods

Cancels a currently running command within an execution context.

EXEC databricks_workspace.compute.commands.cancel 
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"clusterId": "{{ clusterId }}",
"contextId": "{{ contextId }}",
"commandId": "{{ commandId }}"
}';