Skip to main content

tokens

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

Overview

Nametokens
TypeResource
Iddatabricks_workspace.workspace.tokens

Fields

The following fields are returned by SELECT queries:

Request completed successfully.

NameDatatypeDescription
created_by_idinteger
owner_idinteger
token_idstring
workspace_idinteger
commentstring
created_by_usernamestring
creation_timeinteger
expiry_timeinteger
last_used_dayinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectdeployment_nameLists all tokens associated with the specified workspace or user.
getselectdeployment_nameGets information about a token, specified by its ID.
createobotokeninsertdeployment_nameCreates a token on behalf of a service principal.
deletedeletedeployment_nameDeletes a token, specified by its ID.

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

Lists all tokens associated with the specified workspace or user.

SELECT
created_by_id,
owner_id,
token_id,
workspace_id,
comment,
created_by_username,
creation_time,
expiry_time,
last_used_day
FROM databricks_workspace.workspace.tokens
WHERE deployment_name = '{{ deployment_name }}' -- required;

INSERT examples

Creates a token on behalf of a service principal.

INSERT INTO databricks_workspace.workspace.tokens (
data__application_id,
data__lifetime_seconds,
data__comment,
deployment_name
)
SELECT
'{{ application_id }}',
'{{ lifetime_seconds }}',
{{ comment }},
'{{ deployment_name }}'
RETURNING
token_info,
token_value
;

DELETE examples

Deletes a token, specified by its ID.

DELETE FROM databricks_workspace.workspace.tokens
WHERE deployment_name = '{{ deployment_name }}' --required;