Skip to main content

libraries

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

Overview​

Namelibraries
TypeResource
Iddatabricks_workspace.compute.libraries

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
is_library_for_all_clustersbooleanWhether the library was set to be installed on all clusters via the libraries UI.
▶libraryobjectUnique identifier for the library.
messagesarrayAll the info and warning messages that have occurred so far for this library.
statusstringStatus of installing the library on the cluster. (FAILED, INSTALLED, INSTALLING, PENDING, RESOLVING, RESTORED, SKIPPED, UNINSTALL_ON_RESTART)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcluster_id, deployment_nameGet the status of libraries on a cluster. A status is returned for all libraries installed on this
installinsertdeployment_name, cluster_id, librariesAdd libraries to install on a cluster. The installation is asynchronous; it happens in the background
uninstallexecdeployment_name, cluster_id, librariesSet libraries to uninstall from a cluster. The libraries won't be uninstalled until the cluster is

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
cluster_idstringUnique identifier of the cluster whose status should be retrieved.
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)

SELECT examples​

Get the status of libraries on a cluster. A status is returned for all libraries installed on this

SELECT
is_library_for_all_clusters,
library,
messages,
status
FROM databricks_workspace.compute.libraries
WHERE cluster_id = '{{ cluster_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples​

Add libraries to install on a cluster. The installation is asynchronous; it happens in the background

INSERT INTO databricks_workspace.compute.libraries (
cluster_id,
libraries,
deployment_name
)
SELECT
'{{ cluster_id }}' /* required */,
'{{ libraries }}' /* required */,
'{{ deployment_name }}'
;

Lifecycle Methods​

Set libraries to uninstall from a cluster. The libraries won't be uninstalled until the cluster is

EXEC databricks_workspace.compute.libraries.uninstall
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"cluster_id": "{{ cluster_id }}",
"libraries": "{{ libraries }}"
}'
;