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

ALTER OWNER

ALTER OWNER transfers ownership of a resource in the current service group to another user.

Prerequisites

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

  • To change the owner of a resource object, you must be the owner of the resource object or the user with the role ADMIN in the service group.
  • The user that you want to change the owner to is already created and invited to the current service group. For more information, see Create users and INVITE USER.

Syntax

alter_owner_command
ALTER OWNER resource_object_type resource_object_reference TO USER user_name

alter_owner_command ::=
    'ALTER' 'OWNER' resource_object_type resource_object_reference 'TO' 'USER' user_name

Parameters

resource_object_type

The type of the resource object whose owner you want to change. Supported resource object types are SCHEMA, GRAPH TYPE, GRAPH, and PROCEDURE.

Note

The owner of the default schema in the path /default_schema cannot be changed. For more information, see CREATE SCHEMA.

When the owner of a schema changes, the new owner gains implicit USAGE on the schema. The former owner loses the implicit access provided by schema ownership. Any USAGE previously granted directly or through a role remains effective; otherwise, the former owner must be granted USAGE to continue accessing the schema. For more information, see Schema access control.

For more information, see Operations available to resource owners.

resource_object_reference

A reference identifies the resource to transfer. Use a name in the current schema or a reference that includes the schema path:

Resource type Reference in the current schema Reference with a schema path
SCHEMA schema_reference schema_reference
GRAPH TYPE, GRAPH, and PROCEDURE graph_type_name
graph_name
procedure_name(parameter_type, ...)
schema_reference/graph_type_name
schema_reference/graph_name
`schema_reference/procedure_name`(parameter_type, ...)
  • Always use schema_reference for a SCHEMA object.
  • For other objects, omit the schema path only when the object is in the current schema. Include schema_reference for objects in another schema. To set or view the current schema, see SESSION SET SCHEMA and SHOW CURRENT_SCHEMA.
  • schema_reference can be the absolute or relative path of the schema. For more information, see CREATE SCHEMA.
  • If multiple UDP signatures have the same name, specify the parameter types in the UDP reference.

user_name

The name of the user who is the new owner of the resource object.

Examples

Run these examples independently. User user1 must have joined the service group. The movie_type and movie examples require the example dataset to be loaded in /default_schema.

Change the owner of a schema

'''
CREATE SCHEMA IF NOT EXISTS /my_schema  // Create a schema
'''

'''
ALTER OWNER SCHEMA /my_schema TO USER user1
'''

As the new schema owner, user1 gains implicit access to /my_schema. The former owner loses the implicit access provided by schema ownership, but any USAGE previously granted directly or through a role remains effective.

Change the owner of a graph type in the current schema

'''
SESSION SET SCHEMA /default_schema
'''

'''
ALTER OWNER GRAPH TYPE movie_type TO USER user1
'''

Change the owner of a graph type in the specified schema

'''
// Create a schema
CREATE SCHEMA IF NOT EXISTS /my_schema
'''

'''
// Set the schema for the current session
SESSION SET SCHEMA /my_schema
'''

'''
// Create a graph type in the specified schema
CREATE GRAPH TYPE IF NOT EXISTS /my_schema/my_graph_type AS {}
'''

'''
// Change the owner of a graph type in the specified schema
ALTER OWNER GRAPH TYPE /my_schema/my_graph_type TO USER user1
'''

Change the owner of a graph in the current schema

'''
SESSION SET SCHEMA /default_schema
'''

'''
ALTER OWNER GRAPH movie TO USER user1
'''

As a user with ADMIN, run SHOW OBJECTS FOR USER user1 and confirm that the resource appears in the new owner's list. Alternatively, log in as user1 and run SHOW OBJECTS to inspect its own resources. See SHOW OBJECTS for command details.