vw_rule_set_grant_principals
Creates, updates, deletes, gets or lists a vw_rule_set_grant_principals resource.
Overview
| Name | vw_rule_set_grant_principals |
| Type | View |
| Id | databricks_workspace.iam.vw_rule_set_grant_principals |
Fields
The following fields are returned by this view:
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | Workspace deployment name used to scope the query. |
rule_set_name | string | Fully qualified name of the rule set used to scope the query (e.g. accounts/accountId/servicePrincipals/spId/ruleSets/default). |
etag | string | ETag of the rule set used to scope the query and for optimistic concurrency control. |
role | string | Role granted by this grant rule (one row per principal per role). |
principal | string | Principal granted the role (e.g. users/alice@example.com, groups/analysts). |
Required Parameters
The following parameters are required by this view:
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | Workspace deployment name used to scope the query. |
name | string | Fully qualified name of the rule set (e.g. accounts/accountId/servicePrincipals/spId/ruleSets/default). |
etag | string | ETag of the rule set for optimistic concurrency control. |
SELECT Examples
SELECT
deployment_name,
rule_set_name,
etag,
role,
principal
FROM databricks_workspace.iam.vw_rule_set_grant_principals
WHERE deployment_name = '{{ deployment_name }}'
AND name = '{{ name }}'
AND etag = '{{ etag }}';
SQL Definition
- Sqlite3
- Postgres
SELECT
rs.deployment_name,
rs.name AS rule_set_name,
rs.etag,
JSON_EXTRACT(gr.value, '$.role') AS role,
pr.value AS principal
FROM databricks_workspace.iam.rule_sets rs,
JSON_EACH(rs.grant_rules) gr,
JSON_EACH(JSON_EXTRACT(gr.value, '$.principals')) pr
WHERE rs.deployment_name = '{{ deployment_name }}'
AND rs.name = '{{ name }}'
AND rs.etag = '{{ etag }}'
SELECT
rs.deployment_name,
rs.name AS rule_set_name,
rs.etag,
gr.value->>'role' AS role,
pr.value AS principal
FROM databricks_workspace.iam.rule_sets rs,
jsonb_array_elements(rs.grant_rules::jsonb) AS gr,
jsonb_array_elements((gr.value->'principals')::jsonb) AS pr
WHERE rs.deployment_name = '{{ deployment_name }}'
AND rs.name = '{{ name }}'
AND rs.etag = '{{ etag }}'