Skip to main content

users

Operations on a users resource.

Overview

Nameusers
TypeResource
Iddatabricks_workspace.iam.users

Fields

NameDatatype
idstring
nameobject
activeboolean
displayNamestring
emailsarray
entitlementsarray
externalIdstring
groupsarray
rolesarray
schemasarray
userNamestring

Methods

NameAccessible byRequired ParamsDescription
getSELECTid, deployment_nameGets information for a specific user in Databricks workspace.
listSELECTdeployment_nameGets details for all the users associated with a Databricks workspace.
createINSERTdeployment_nameCreates a new user in the Databricks workspace. This new user will also be added to the Databricks account.
deleteDELETEid, deployment_nameDeletes a user. Deleting a user from a Databricks workspace also removes objects associated with the user.
patchUPDATEid, deployment_namePartially updates a user resource by applying the supplied operations on specific user attributes.
updateUPDATEid, deployment_nameReplaces a user's information with the data supplied in request.

SELECT examples

SELECT
id,
name,
active,
displayName,
emails,
entitlements,
externalId,
groups,
roles,
schemas,
userName
FROM databricks_workspace.iam.users
WHERE deployment_name = '{{ deployment_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new users resource.

/*+ create */
INSERT INTO databricks_workspace.iam.users (
deployment_name,
data__schemas,
data__userName,
data__emails,
data__name,
data__displayName,
data__groups,
data__roles,
data__entitlements,
data__externalId,
data__active
)
SELECT
'{{ deployment_name }}',
'{{ schemas }}',
'{{ userName }}',
'{{ emails }}',
'{{ name }}',
'{{ displayName }}',
'{{ groups }}',
'{{ roles }}',
'{{ entitlements }}',
'{{ externalId }}',
'{{ active }}'
;

UPDATE example

Updates a users resource.

/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.iam.users
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE id = '{{ id }}' AND
deployment_name = '{{ deployment_name }}';

DELETE example

Deletes a users resource.

/*+ delete */
DELETE FROM databricks_workspace.iam.users
WHERE id = '{{ id }}' AND
deployment_name = '{{ deployment_name }}';