Skip to main content

users

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

Overview​

Nameusers
TypeResource
Iddatabricks_account.iamv2.users

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
account_idstringThe accountId parent of the user in Databricks.
external_idstringExternalId of the user in the customer's IdP.
user_idstringInternal userId of the user in Databricks.
â–¶full_nameobject
account_user_statusstringThe activity status of a user in a Databricks account. (ACTIVE, INACTIVE)
usernamestringUsername/email of the user.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, user_id, account_hostFetches a user from the Databricks account by its internal ID.
listselectaccount_id, account_hostfilter, page_size, page_tokenLists the users in the Databricks account, returning one page per call. Supports filtering by username
createinsertaccount_id, account_host, username, full_name, account_user_statusCreates a local user in the Databricks account and returns the created user. A local user is one that
updateupdateaccount_id, user_id, update_mask, account_host, username, full_name, account_user_statusUpdates an existing user in the Databricks account and returns the updated user. Only the fields named
deletedeleteaccount_id, user_id, account_hostDeletes a user from the Databricks account by its internal ID.
resolveexecaccount_id, account_host, external_idResolves a user with the given external ID from the customer's IdP. If the user does not exist, it

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
account_hoststringThe Databricks account console host. Selected by DATABRICKS_CLOUD (aws, azure or gcp; default aws), or set explicitly with DATABRICKS_ACCOUNT_HOST (bare host, no scheme). (default: accounts.cloud.databricks.com, x-stackQL-envVar: DATABRICKS_ACCOUNT_HOST, x-stackQL-envVarSelector: {"envVar":"DATABRICKS_CLOUD","default":"aws","values":{"aws":"accounts.cloud.databricks.com","azure":"accounts.azuredatabricks.net","gcp":"accounts.gcp.databricks.com"}})
account_idstring
update_maskstringRequired. The list of fields to update.
user_idstringRequired. Internal ID of the user in Databricks.
filterstringOptional. Allows filtering users by username or external id.
page_sizeintegerThe maximum number of users to return. The service may return fewer than this value. If not provided, defaults to 1000, which is also the maximum allowed. Requests for more than the maximum are clamped to 1000.
page_tokenstringA page token, received from a previous ListUsers call. Provide this to retrieve the subsequent page.

SELECT examples​

Fetches a user from the Databricks account by its internal ID.

SELECT
account_id,
external_id,
user_id,
full_name,
account_user_status,
username
FROM databricks_account.iamv2.users
WHERE account_id = '{{ account_id }}' -- required
AND user_id = '{{ user_id }}' -- required
AND account_host = '{{ account_host }}' -- required
;

INSERT examples​

Creates a local user in the Databricks account and returns the created user. A local user is one that

INSERT INTO databricks_account.iamv2.users (
username,
full_name,
account_user_status,
account_id,
external_id,
user_id,
account_id,
account_host
)
SELECT
'{{ username }}' /* required */,
'{{ full_name }}' /* required */,
'{{ account_user_status }}' /* required */,
'{{ account_id }}',
'{{ external_id }}',
'{{ user_id }}',
'{{ account_id }}',
'{{ account_host }}'
RETURNING
account_id,
external_id,
user_id,
full_name,
account_user_status,
username
;

UPDATE examples​

Updates an existing user in the Databricks account and returns the updated user. Only the fields named

UPDATE databricks_account.iamv2.users
SET
username = '{{ username }}',
full_name = '{{ full_name }}',
account_user_status = '{{ account_user_status }}',
account_id = '{{ account_id }}',
external_id = '{{ external_id }}',
user_id = '{{ user_id }}'
WHERE
account_id = '{{ account_id }}' --required
AND user_id = '{{ user_id }}' --required
AND update_mask = '{{ update_mask }}' --required
AND account_host = '{{ account_host }}' --required
AND username = '{{ username }}' --required
AND full_name = '{{ full_name }}' --required
AND account_user_status = '{{ account_user_status }}' --required
RETURNING
account_id,
external_id,
user_id,
full_name,
account_user_status,
username;

DELETE examples​

Deletes a user from the Databricks account by its internal ID.

DELETE FROM databricks_account.iamv2.users
WHERE account_id = '{{ account_id }}' --required
AND user_id = '{{ user_id }}' --required
AND account_host = '{{ account_host }}' --required
;

Lifecycle Methods​

Resolves a user with the given external ID from the customer's IdP. If the user does not exist, it

EXEC databricks_account.iamv2.users.resolve
@account_id='{{ account_id }}' --required,
@account_host='{{ account_host }}' --required
@@json=
'{
"external_id": "{{ external_id }}"
}'
;