# role\_privileges

## Description

Exposes all privilege grants for roles in the organization. Use this table to audit what privileges each role holds, on which resources, and who granted them. Only privilege rows for roles the current role has USAGE privileges on are returned.

## Syntax

```sql
SELECT * FROM deltastream.sys."role_privileges";
```

## Columns

| Column                  | Type           | Nullable | Description                                                                         |
| ----------------------- | -------------- | -------- | ----------------------------------------------------------------------------------- |
| `role_name`             | VARCHAR        | No       | Name of the role that holds this privilege.                                         |
| `role_priv_type`        | VARCHAR        | No       | Type of privilege, e.g. `usage`, `create_compute_pool`, `select`, `insert`.         |
| `role_priv_target`      | VARCHAR        | No       | Resource type the privilege is on, e.g. `organization`, `compute_pool`, `relation`. |
| `role_priv_target_name` | VARCHAR        | No       | Name of the specific resource the privilege is granted on.                          |
| `grant_option`          | BOOLEAN        | No       | Whether the role can grant this privilege to other roles.                           |
| `grantor_role`          | VARCHAR        | No       | Name of the role that granted this privilege.                                       |
| `granted_at`            | TIMESTAMP\_LTZ | No       | Timestamp when the privilege was granted.                                           |
| `organization_id`       | VARCHAR        | No       | The unique identifier of the organization this resource belongs to.                 |

## Examples

List all role privileges:

```sql
SELECT * FROM deltastream.sys."role_privileges";
```

```sh
[{"role_name":"public","role_priv_type":"usage","role_priv_target":"organization","role_priv_target_name":"asdf","grant_option":false,"grantor_role":"orgadmin","granted_at":"2025-05-22T23:21:22.962Z","organization_id":"00000000-0000-0000-0000-000000000001"},{"role_name":"sysadmin","role_priv_type":"create_compute_pool","role_priv_target":"organization","role_priv_target_name":"asdf","grant_option":true,"grantor_role":"orgadmin","granted_at":"2025-05-22T23:21:22.962Z","organization_id":"00000000-0000-0000-0000-000000000001"}]
```

Find all privileges for a specific role:

```sql
SELECT role_priv_type, role_priv_target, role_priv_target_name, grant_option FROM deltastream.sys."role_privileges" WHERE role_name = 'sysadmin';
```

## See Also

* [System Tables Overview](https://docs.deltastream.io/reference/sql-syntax/systables)
* [GRANT PRIVILEGES](https://docs.deltastream.io/reference/sql-syntax/command/grant-privileges)
* [roles](https://docs.deltastream.io/reference/sql-syntax/systables/roles)
* [user\_grants](https://docs.deltastream.io/reference/sql-syntax/systables/user-grants)
