REVOKE FROM USER
Description
Revoke permissions that have been granted to a specified user or role. Supports revoking both object privileges and role grants.
Syntax
Revoke Object Permissions from a User
Revoke a Role from a User
Privilege Type Definitions
Parameter Description
| Parameter | Required | Description |
|---|---|---|
GRANT OPTION FOR | No | Revokes only the re-grant ability (WITH GRANT OPTION) while preserving the underlying permission itself |
workspace_name | Yes (when revoking workspace privileges) | Workspace name |
workspace_object_name | Yes (when revoking workspace object privileges) | Name of the object under the workspace |
schema_name | Yes (when revoking schema privileges) | Schema name |
schema_object_name | Yes (when revoking schema object privileges) | Full object name in the format schema_name.object_name |
user_name | Yes | The name of the user whose permissions are being revoked |
role_name | Yes (when revoking a role) | The name of the role to revoke |
Usage Examples
-
Revoke the role
test_readonly_rolefrom usertester: -
Revoke user
tester's permission to query tablesemantic_model_test.dim_customer: -
Revoke user
tester's permission to create tables under schemasemantic_model_test: -
Revoke user
tester's permission to create a VCluster in the workspace: -
Revoke role
test_developer_role's permission to create views under schemasemantic_model_test:
A successful command returns an empty result set. No error message means the revocation succeeded.
Notes
- Executing this command requires the
workspace_adminorsecurity_adminrole. - Revoking a permission that the user does not hold will not raise an error; the command silently succeeds and returns an empty result set.
- Revoking a role (
REVOKE ROLE) only removes the association between the user and that role; it does not affect the role itself or other users who hold the role. - Using
GRANT OPTION FORrevokes only the user's ability to re-grant the permission, without affecting their own access to the resource. - Permissions obtained indirectly through a role cannot be revoked directly with
REVOKE; you must first revoke the role (REVOKE ROLE). - Use
SHOW GRANTS TO USER user_nameto verify the revocation result.
