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 TYPE command

The SHOW CREATE GRAPH TYPE command returns the CREATE GRAPH TYPE statement that creates the specified graph type.

If the graph type is changed by using ALTER GRAPH TYPE after creation, the changes are reflected in the return of SHOW CREATE GRAPH TYPE.

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_type_command
SHOW CREATE GRAPH TYPE schema_reference / graph_type_name

show_create_graph_type_command ::=
    'SHOW' 'CREATE' 'GRAPH TYPE' (schema_reference '/')? graph_type_name

Parameters

schema_reference

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

Both absolute and relative schema paths can be used in the command. To view the CREATE GRAPH TYPE statement that creates a graph type 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_type_name

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

Examples

The following examples are based on the example dataset.

Show the CREATE GRAPH TYPE statement

SHOW CREATE GRAPH TYPE movie_type

Return:

+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| graph_type_name | create_graph_type_statement                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| movie_type      | CREATE GRAPH TYPE IF NOT EXISTS `movie_type` AS {\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} |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

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

Show the CREATE GRAPH TYPE statement for 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
'''

'''
// Show the CREATE GRAPH TYPE statement
SHOW CREATE GRAPH TYPE /default_schema/movie_type
'''

Return:

+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| graph_type_name | create_graph_type_statement                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| movie_type      | CREATE GRAPH TYPE IF NOT EXISTS `movie_type` AS {\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} |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

The preceding example returns the CREATE GRAPH TYPE statement used for creating the graph type movie_type in the specified schema /default_schema when the schema for the current session is set to /my_schema.