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

EXPORT SCHEMA command

The EXPORT SCHEMA command returns the resource objects and the statements used to create those resource objects across all schemas within the current service group.

The EXPORT SCHEMA command returns the resource objects in a specific schema and the statements used to create these resource objects.

The following table describes the returned information of these commands:

Column Description
entity The resource object that constitutes the schema, which can be a graph, graph type or index.
statement The statement that defines the resource object.

Prerequisites

To run EXPORT SCHEMA, you must be the user with the role ADMIN. For more information, see Roles and privileges.

Syntax

export_schemas_command
EXPORT SCHEMA
export_schema_command
EXPORT SCHEMA schema_reference

export_schemas_command ::=
    'EXPORT' 'SCHEMA'
export_schema_command ::=
    'EXPORT' 'SCHEMA' schema_reference

Parameters

schema_reference

The reference to the path of the schema. It specifies the path of the schema to be exported.

The path is case-sensitive and must match the path of an existing schema. Both absolute and relative schema paths can be used in the command.

Examples

Export all schemas

EXPORT SCHEMA

Return:

+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| entity          | statement                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GraphType       | 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} |
| Graph           | CREATE GRAPH IF NOT EXISTS `movie` TYPED `movie_type`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| NodeIndex       | CREATE INDEX IF NOT EXISTS `idx_actor_age` FOR `movie` ON NODE `Actor`(birthDate)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| GraphType       | CREATE GRAPH TYPE IF NOT EXISTS `export_type` AS {\n  NODE TYPE `player` (LABEL `player`{`id` INT64 NOT NULL, `age` INT64 DEFAULT NULL, `v1` VECTOR<3, FLOAT> DEFAULT NULL, PRIMARY KEY (`id`)}),\n  EDGE TYPE `follow` (`player`)-[LABEL `follow`{`s1` STRING DEFAULT NULL, `v2` VECTOR<3, FLOAT> DEFAULT NULL}]->(`player`)\n}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Graph           | CREATE GRAPH IF NOT EXISTS `export_test` TYPED `export_type`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| NodeIndex       | CREATE INDEX IF NOT EXISTS `i_player_age` FOR `export_test` ON NODE `player`(age)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| EdgeIndex       | CREATE INDEX IF NOT EXISTS `i_follow_s1` ON EDGE `follow`(s1) FOR `export_test`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| NodeVectorIndex | CREATE VECTOR INDEX IF NOT EXISTS `i_ann_player_v1` FOR `export_test` ON NODE `player`::v1 OPTIONS {dim: 3, type: IVF, metric: L2}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| EdgeVectorIndex | CREATE VECTOR INDEX IF NOT EXISTS `i_ann_follow_v2` FOR `export_test` ON EDGE `follow`::v2 OPTIONS {dim: 3, type: IVF, metric: L2}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Export a specific schema

EXPORT SCHEMA /default_schema

Return:

+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| entity    | statement                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GraphType | 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} |
| Graph     | CREATE GRAPH IF NOT EXISTS `movie` TYPED `movie_type`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| NodeIndex | CREATE INDEX IF NOT EXISTS `idx_actor_age` FOR `movie` ON NODE `Actor`(birthDate)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+