Skip to main content

tokens

Operations on a tokens resource.

Overview

Nametokens
TypeResource
Iddatabricks_workspace.workspace.tokens

Fields

NameDatatype
commentstring
created_by_idinteger
created_by_usernamestring
creation_timeinteger
expiry_timeinteger
last_used_dayinteger
owner_idinteger
token_idstring
workspace_idinteger

Methods

NameAccessible byRequired ParamsDescription
getSELECTtoken_id, deployment_nameGets information about a token, specified by its ID.
listSELECTdeployment_nameLists all tokens associated with the specified workspace or user.
createobotokenINSERTdeployment_nameCreates a token on behalf of a service principal.
deleteDELETEtoken_id, deployment_nameDeletes a token, specified by its ID.

SELECT examples

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

INSERT example

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

/*+ create */
INSERT INTO databricks_workspace.workspace.tokens (
deployment_name,
data__application_id,
data__lifetime_seconds,
data__comment
)
SELECT
'{{ deployment_name }}',
'{{ application_id }}',
'{{ lifetime_seconds }}',
'{{ comment }}'
;

DELETE example

Deletes a tokens resource.

/*+ delete */
DELETE FROM databricks_workspace.workspace.tokens
WHERE token_id = '{{ token_id }}' AND
deployment_name = '{{ deployment_name }}';