On this page

    Roles

    Role management may be performed via the SQL editor. To grant or revoke privileges to a role, use the GRANT command.

    Creating a New Role

    Syntax
    CREATE ROLE "<role_name>"
    

    Parameters

    <role_name>

    String

    Indicates the name you wish to give the new role.

    Example

    Create a new role
    CREATE ROLE "role1"
    

    Granting a Role to a User

    Syntax
    GRANT ROLE "<role_name>"
        TO USER "<username>"
    

    Parameters

    <role_name>

    String

    Indicates the name of the role you are assigning to a user.


    <username>

    String

    Indicates the username associated with the user account you are granting to the role.

    Example

    Grant a role to a user
    GRANT ROLE "role1"
        TO USER "user@dremio.com"
    

    Revoking a Role from a User

    Syntax
    REVOKE ROLE "<role_name>"
        FROM USER "<username>"
    

    Parameters

    <role_name>

    String

    Indicates the name of the role you wish to revoke.


    <username>

    String

    Indicates the username associated with the user account you are revoking the role from.

    Example

    Revoke a role from a user
    REVOKE ROLE "role1"
        FROM USER "user@dremio.com"
    

    Nesting a Role within a Role

    Syntax
    GRANT ROLE "<sub_role>"
        TO ROLE "<parent_role>"
    

    Parameters

    <sub_role>

    String

    Indicates the name of the role that you want to be nested.


    <parent_role>

    String

    Indicates the name of the role that will be used as the parent to the nested role.

    Example

    Nesting a role within a role
    GRANT ROLE "subrole"
        TO ROLE "role1"
    

    Removing a Nested Role

    Syntax
    REVOKE ROLE "<sub_role>"
        FROM ROLE "<parent_role>"
    

    Parameters

    <sub_role>

    String

    Indicates the name of the role that you wish to remove from the parent role.


    <parent_role>

    String

    Indicates the name of the parent that the nested role is currently assigned to.

    Example

    Removing a nested role from a parent role
    REVOKE ROLE "subrole"
        FROM ROLE "role1"
    

    Deleting a Role

    Syntax
    DROP ROLE "<role_name>"
    

    Parameters

    <role_name>

    String

    Indicates the role you are deleted.

    Example

    Deleting a role
    DROP ROLE "role1"