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

RENAME GRAPH statement

The RENAME GRAPH statement renames a graph in the schema of the current session or a specified schema.

Note

Renaming temporary graphs is not supported.

Note

An operation involving a non-default schema or an object in it requires access to the schema, either implicitly or through an explicit USAGE grant, as well as the privilege required for the operation. The schema access check and the privilege check for the requested operation are independent; satisfying one does not satisfy the other. Schema access control does not apply to temporary graphs or built-in procedures and functions. For more information, see Schema access control.

Prerequisites

  • A graph is created. For more information, see CREATE GRAPH.
  • To rename a graph, you must either be the owner of the graph, be granted to perform the action ALTER on the graph, or be granted to perform the action ALTER ANY GRAPH on the corresponding schema. For more information, see Roles and privileges.

Syntax

rename_graph_statement
RENAME PROPERTY GRAPH schema_reference / old_graph_name TO schema_reference / new_graph_name

rename_graph_statement ::=
    'RENAME' 'PROPERTY'? 'GRAPH' (schema_reference '/')? old_graph_name 'TO' (schema_reference '/')? new_graph_name

Parameters

schema_reference

The reference to the path of the schema. It specifies the schema path of the graph to be renamed here.

  • Both absolute and relative schema paths can be used in the statement. To rename the graph that is not in the schema of the current session, the schema path must be specified. For information about setting and viewing the schema, see SESSION SET and SHOW CURRENT_SCHEMA.
  • The schema path of the graph cannot be changed after renaming.

old_graph_name

The current name of the graph.

new_graph_name

The new name of the graph.

Examples

The following examples are based on the example dataset.

Rename a graph in the current schema

RENAME GRAPH movie TO movie_renamed

The preceding example renames the graph movie to movie_renamed.

Rename a graph in the specified schema

RENAME GRAPH /default_schema/my_graph TO /default_schema/my_graph_renamed

The preceding example renames the graph my_graph created in the Examples section of CREATE GRAPH to my_graph_renamed.