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

SHOW CREATE GRAPH command

The SHOW CREATE GRAPH command returns the CREATE GRAPH statement that creates the specified graph or the CREATE TEMPORARY GRAPH statement that creates the specified temporary graph.

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.

Syntax

show_create_graph_command
SHOW CREATE GRAPH schema_reference / graph_name temp_graph_name

show_create_graph_command ::=
    'SHOW' 'CREATE' 'GRAPH' ((schema_reference '/')? graph_name | temp_graph_name)

Parameters

schema_reference

The reference to the path of the schema. It specifies the schema path of the graph for which to return the CREATE GRAPH statement here.

Both absolute and relative schema paths can be used in the command. To view the CREATE GRAPH statement that creates a graph residing outside the schema in the current session, the schema path must be specified. For information about setting and viewing the schema for the current session, see SESSION SET and SHOW CURRENT_SCHEMA.

graph_name

The name of the graph for which to return the CREATE GRAPH statement.

temp_graph_name

The name of the temporary graph for which to return the CREATE TEMPORARY GRAPH statement. It must start with a number sign (#).

Examples

The following examples are based on the example dataset.

Show the CREATE GRAPH statement for a graph in the current schema

SHOW CREATE GRAPH movie

Return:

+------------+-------------------------------------------------------+
| graph_name | create_graph_statement                                |
+------------+-------------------------------------------------------+
| movie      | CREATE GRAPH IF NOT EXISTS `movie` TYPED `movie_type` |
+------------+-------------------------------------------------------+

The preceding example returns the CREATE GRAPH statement used for creating the graph movie in the current schema.

Show the CREATE GRAPH statement for a graph in the specified schema

SHOW CREATE GRAPH /default_schema/my_graph

Return:

+------------+-------------------------------------------------------------+
| graph_name | create_graph_statement                                      |
+------------+-------------------------------------------------------------+
| my_graph   | CREATE GRAPH IF NOT EXISTS `my_graph` TYPED `my_graph_type` |
+------------+-------------------------------------------------------------+

The preceding example returns the CREATE GRAPH statement used for creating the graph my_graph introduced in CREATE GRAPH when the schema is set to /my_schema in the current session.

Show the CREATE GRAPH statement for a temporary graph

SHOW CREATE GRAPH #my_temporary_graph

Return:

+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| graph_name          | create_graph_statement                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| #my_temporary_graph | CREATE TEMPORARY GRAPH IF NOT EXISTS `#my_temporary_graph` TYPED {\n  NODE TYPE `Actor` (LABEL `Person`{`id` INT64 NOT NULL, `name` STRING DEFAULT NULL, `birthDate` DATE DEFAULT NULL, PRIMARY KEY (`id`)}),\n  NODE TYPE `Director` (LABEL `Person`{`id` INT64 NOT NULL, `name` STRING DEFAULT NULL, `birthDate` DATE DEFAULT NULL, PRIMARY KEY (`id`)}),\n  NODE TYPE `User` (LABEL `Person`{`id` INT64 NOT NULL, PRIMARY KEY (`id`)}),\n  NODE TYPE `Movie` (LABEL `Movie`{`id` INT64 NOT NULL, `name` STRING DEFAULT NULL, PRIMARY KEY (`id`)}),\n  NODE TYPE `Genre` (LABEL `Genre`{`id` INT64 NOT NULL, `name` STRING DEFAULT NULL, PRIMARY KEY (`id`)}),\n  EDGE TYPE `Act` (`Actor`)-[LABEL `Act`{}]->(`Movie`),\n  EDGE TYPE `Direct` (`Director`)-[LABEL `Direct`{}]->(`Movie`),\n  EDGE TYPE `Watch` (`User`)-[LABEL `Watch`{`rate` FLOAT DEFAULT NULL}]->(`Movie`),\n  EDGE TYPE `WithGenre` (`Movie`)-[LABEL `WithGenre`{}]->(`Genre`)\n} OPTIONS {immutable: false} |
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

The preceding example returns the CREATE GRAPH statement used for creating the temporary graph #my_temporary_graph introduced in CREATE TEMPORARY GRAPH.