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

DESCRIBE GRAPH TYPE command

The DESCRIBE GRAPH TYPE command returns detailed information about a graph type in a table that consists of the following columns:

Column Description
entity_type The type of the graph element. Valid values: Node and Edge.
type_name The name of the graph element type.
type_pattern The pattern of the graph element type.
If the graph element is a node, the pattern follows the format of (node_type_name).
If the graph element is a directed edge, the pattern follows the format of (source_node_type_name)-[edge_type_name]->(destination_node_type_name).
If the graph element is an undirected edge, the pattern follows the format of (node_type_name_1)~[edge_type_name]~(node_type_name_2).
labels The label set of the graph element.
primary_key/multiedge_key The primary key or multiedge key of the graph element. For more information, see CREATE GRAPH TYPE.
properties The names of the properties of the graph element.

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

describe_graph_type_command
DESCRIBE DESC GRAPH TYPE schema_reference / graph_type_name

describe_graph_type_command ::=
    ( 'DESCRIBE' | 'DESC' ) '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 that you want to know details about here.

Both absolute and relative schema paths can be used in the command. To view detailed information about a graph type that resides 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 that you want to know details about.

Examples

The following examples are based on the example dataset.

Describe a graph type in the current schema

DESCRIBE GRAPH TYPE movie_type

Return:

+-------------+-----------+------------------------------+-------------+---------------------------+---------------------+
| entity_type | type_name | type_pattern                 | labels      | primary_key/multiedge_key | properties          |
+-------------+-----------+------------------------------+-------------+---------------------------+---------------------+
| Node        | Actor     | (Actor)                      | [Person]    | [id]                      | [id,name,birthDate] |
| Node        | Director  | (Director)                   | [Person]    | [id]                      | [id,name,birthDate] |
| Node        | User      | (User)                       | [Person]    | [id]                      | [id]                |
| Node        | Movie     | (Movie)                      | [Movie]     | [id]                      | [id,name]           |
| Node        | Genre     | (Genre)                      | [Genre]     | [id]                      | [id,name]           |
| Edge        | Act       | (Actor)-[Act]->(Movie)       | [Act]       | Unique                    | []                  |
| Edge        | Direct    | (Director)-[Direct]->(Movie) | [Direct]    | Unique                    | []                  |
| Edge        | Watch     | (User)-[Watch]->(Movie)      | [Watch]     | Unique                    | [rate]              |
| Edge        | WithGenre | (Movie)-[WithGenre]->(Genre) | [WithGenre] | Unique                    | []                  |
+-------------+-----------+------------------------------+-------------+---------------------------+---------------------+

Describe 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
'''

'''
// Describe a graph type in the specified
DESCRIBE GRAPH TYPE /default_schema/movie_type
'''

Return:

+-------------+-----------+------------------------------+-------------+---------------------------+---------------------+
| entity_type | type_name | type_pattern                 | labels      | primary_key/multiedge_key | properties          |
+-------------+-----------+------------------------------+-------------+---------------------------+---------------------+
| Node        | Actor     | (Actor)                      | [Person]    | [id]                      | [id,name,birthDate] |
| Node        | Director  | (Director)                   | [Person]    | [id]                      | [id,name,birthDate] |
| Node        | User      | (User)                       | [Person]    | [id]                      | [id]                |
| Node        | Movie     | (Movie)                      | [Movie]     | [id]                      | [id,name]           |
| Node        | Genre     | (Genre)                      | [Genre]     | [id]                      | [id,name]           |
| Edge        | Act       | (Actor)-[Act]->(Movie)       | [Act]       | Unique                    | []                  |
| Edge        | Direct    | (Director)-[Direct]->(Movie) | [Direct]    | Unique                    | []                  |
| Edge        | Watch     | (User)-[Watch]->(Movie)      | [Watch]     | Unique                    | [rate]              |
| Edge        | WithGenre | (Movie)-[WithGenre]->(Genre) | [WithGenre] | Unique                    | []                  |
+-------------+-----------+------------------------------+-------------+---------------------------+---------------------+