Skip to content
Developer Edition runs on one host and does not require a product license file. Need multi-host deployment or performance testing at scale? Explore Enterprise Edition

CREATE ROLE

CREATE ROLE creates a custom role in the current service group. A new role has no privileges until you add them with GRANT.

Prerequisites

First connect to the Graph service. Run the command in a GQL client.

To create a role, you must have ADMIN in the current service group.

Syntax

create_role_command
CREATE ROLE IF NOT EXISTS role_name COMMENT " comment "

create_role_command ::=
    'CREATE' 'ROLE' ('IF NOT EXISTS')? role_name  ('COMMENT' '"' comment '"')?

Parameters

IF NOT EXISTS

Skip creation if the role exists, preserving its description and privileges. Without this clause, an existing role with the same name causes an error.

role_name

The name of the role to be created. role_name must be a regular identifier. For more information about identifiers, see Rules for naming identifiers.

comment

The description of the role. The description must be a string literal.

Examples

CREATE ROLE IF NOT EXISTS role1 COMMENT "This is role1"

Check SHOW ALL ROLES for a record with name set to role1 and comment set to This is role1.