Skip to main content

vw_workspace_assignments

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

Overview

Namevw_workspace_assignments
TypeView
Iddatabricks_account.iam.vw_workspace_assignments

Fields

The following fields are returned by this view:

NameDatatypeDescription
account_idstringDatabricks account ID used to scope the query.
workspace_idintegerNumeric ID of the workspace used to scope the query.
principal_idintegerNumeric ID of the principal assigned to the workspace.
display_namestringDisplay name of the assigned principal.
user_namestringUsername of the assigned principal if the principal is a user.
group_namestringGroup name of the assigned principal if the principal is a group.
service_principal_namestringApplication name of the assigned principal if the principal is a service principal.
permissionstringPermission level granted to the principal on the workspace (one row per permission, e.g. USER, ADMIN).

Required Parameters

The following parameters are required by this view:

NameDatatypeDescription
account_idstringDatabricks account ID used to scope the query.
workspace_idintegerNumeric ID of the workspace used to scope the query.

SELECT Examples

SELECT
account_id,
workspace_id,
principal_id,
display_name,
user_name,
group_name,
service_principal_name,
permission
FROM databricks_account.iam.vw_workspace_assignments
WHERE account_id = '{{ account_id }}'
AND workspace_id = '{{ workspace_id }}';

SQL Definition

SELECT
wa.account_id,
wa.workspace_id,
JSON_EXTRACT(wa.principal, '$.principal_id') AS principal_id,
JSON_EXTRACT(wa.principal, '$.display_name') AS display_name,
JSON_EXTRACT(wa.principal, '$.user_name') AS user_name,
JSON_EXTRACT(wa.principal, '$.group_name') AS group_name,
JSON_EXTRACT(wa.principal, '$.service_principal_name') AS service_principal_name,
p.value AS permission
FROM databricks_account.iam.workspace_assignment wa,
JSON_EACH(wa.permissions) p
WHERE account_id = '{{ account_id }}'
AND workspace_id = '{{ workspace_id }}'