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:

Request completed successfully.

NameDatatypeDescription
cluster_idstring
library_statusesarray

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
clusterstatusselectdeployment_nameGet the status of libraries on a cluster. A status is returned for all libraries installed on this cluster via the API or the libraries UI. The order of returned libraries is as follows:
allclusterlibrarystatusesselectdeployment_nameGet the status of all libraries on all clusters. A status is returned for all libraries installed on this cluster via the API or the libraries UI.
installinsertdeployment_nameAdd libraries to install on a cluster. The installation is asynchronous; it happens in the background after the completion of this request.
uninstalldeletedeployment_nameSet libraries to uninstall from a cluster. The libraries won't be uninstalled until the cluster is restarted. A request to uninstall a library that is not currently installed is ignored.

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

Get the status of libraries on a cluster. A status is returned for all libraries installed on this cluster via the API or the libraries UI. The order of returned libraries is as follows:

SELECT
cluster_id,
library_statuses
FROM databricks_workspace.compute.libraries
WHERE deployment_name = '{{ deployment_name }}' -- required;

INSERT examples

Add libraries to install on a cluster. The installation is asynchronous; it happens in the background after the completion of this request.

INSERT INTO databricks_workspace.compute.libraries (
data__cluster_id,
data__libraries,
deployment_name
)
SELECT
'{{ cluster_id }}',
'{{ libraries }}',
'{{ deployment_name }}'
;

DELETE examples

Set libraries to uninstall from a cluster. The libraries won't be uninstalled until the cluster is restarted. A request to uninstall a library that is not currently installed is ignored.

DELETE FROM databricks_workspace.compute.libraries
WHERE deployment_name = '{{ deployment_name }}' --required;