tokens
Operations on a tokens
resource.
Overview
Name | tokens |
Type | Resource |
Id | databricks_workspace.workspace.tokens |
Fields
Name | Datatype |
---|---|
comment | string |
created_by_id | integer |
created_by_username | string |
creation_time | integer |
expiry_time | integer |
last_used_day | integer |
owner_id | integer |
token_id | string |
workspace_id | integer |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | token_id, deployment_name | Gets information about a token, specified by its ID. |
list | SELECT | deployment_name | Lists all tokens associated with the specified workspace or user. |
createobotoken | INSERT | deployment_name | Creates a token on behalf of a service principal. |
delete | DELETE | token_id, deployment_name | Deletes a token, specified by its ID. |
SELECT
examples
- tokens (list)
- tokens (get)
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 }}';
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 token_id = '{{ token_id }}' AND
deployment_name = '{{ deployment_name }}';
INSERT
example
Use the following StackQL query and manifest file to create a new tokens
resource.
- tokens
- Manifest
/*+ 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 }}'
;
- name: your_resource_model_name
props:
- name: application_id
value: 6f5ccf28-d83a-4957-9bfb-5bbfac551410
- name: lifetime_seconds
value: 3600
- name: comment
value: This is for the ABC department automation scripts.
DELETE
example
Deletes a tokens
resource.
/*+ delete */
DELETE FROM databricks_workspace.workspace.tokens
WHERE token_id = '{{ token_id }}' AND
deployment_name = '{{ deployment_name }}';