# user\_grants

## Description

Exposes the mapping of users to roles within the organization. Each row represents a single user-to-role grant. Requires USAGE privilege on the organization.

## Syntax

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

## Columns

| Column            | Type           | Nullable | Description                                                         |
| ----------------- | -------------- | -------- | ------------------------------------------------------------------- |
| `org_member_id`   | VARCHAR        | No       | Unique identifier of the organization membership record.            |
| `user_name`       | VARCHAR        | No       | Display name of the user.                                           |
| `user_email`      | VARCHAR        | No       | Email address of the user.                                          |
| `role_name`       | VARCHAR        | No       | Name of the role granted to the user.                               |
| `granted_at`      | TIMESTAMP\_LTZ | No       | Timestamp when the role was granted to the user.                    |
| `organization_id` | VARCHAR        | No       | The unique identifier of the organization this resource belongs to. |

## Examples

```sh
$ dsql -e 'SELECT * FROM deltastream.sys."user_grants";'
[{"org_member_id":"00000000-0000-0000-0000-000000000002","user_name":"User Name","user_email":"user@example.com","role_name":"orgadmin","granted_at":"2025-05-22T23:21:22.962Z","organization_id":"00000000-0000-0000-0000-000000000001"},{"org_member_id":"00000000-0000-0000-0000-000000000003","user_name":"User2 Name","user_email":"user2@example.com","role_name":"sysadmin","granted_at":"2025-05-23T21:03:05.239Z","organization_id":"00000000-0000-0000-0000-000000000001"}]
```

Find all roles granted to a specific user by email:

```sql
SELECT role_name, granted_at FROM deltastream.sys."user_grants" WHERE user_email = 'rick@example.com';
```

## See Also

* [System Tables Overview](https://docs.deltastream.io/reference/sql-syntax/systables)
* [LIST USERS](https://docs.deltastream.io/reference/sql-syntax/command/list-users)
* [GRANT ROLE](https://docs.deltastream.io/reference/sql-syntax/command/grant-role)
* [role\_privileges](https://docs.deltastream.io/reference/sql-syntax/systables/role-privileges)
