Source: https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/show-create-graph-type/ Documentation version: v5.3.2 # SHOW CREATE GRAPH TYPE command The SHOW CREATE GRAPH TYPE command returns the [CREATE GRAPH TYPE](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/graph-type/create/) statement that creates the specified graph type. If the graph type is changed by using [ALTER GRAPH TYPE](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/ddl/graph-type/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](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authorization/schema-access-control/). ## Syntax diagramsource show_create_graph_type_command ```` 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](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/sessions/set/) and [SHOW CURRENT_SCHEMA](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-admin/show/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](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/overview/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`.