apoc.export.cypher.schema

This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13). For more information, see the Cypher Manual → Parallel runtime.

Details

Syntax

apoc.export.cypher.schema([, file, config ]) :: (file, batches, source, format, nodes, relationships, properties, time, rows, batchSize, cypherStatements, nodeStatements, relationshipStatements, schemaStatements, cleanupStatements)

Description

Exports all schema indexes and constraints to Cypher statements.

Input arguments

Name

Type

Description

file

STRING

The name of the file to which the data will be exported. The default is: ``.

config

MAP

{ stream = false :: BOOLEAN, batchSize = 20000 :: INTEGER, bulkImport = false :: BOOLEAN, timeoutSeconds = 100 :: INTEGER, compression = 'None' :: STRING, charset = 'UTF_8' :: STRING, sampling = false :: BOOLEAN, samplingConfig :: MAP }. The default is: {}.

Return arguments

Name

Type

Description

file

STRING

The name of the file to which the data was exported.

batches

INTEGER

The number of batches the export was run in.

source

STRING

A summary of the exported data.

format

STRING

The format the file is exported in.

nodes

INTEGER

The number of exported nodes.

relationships

INTEGER

The number of exported relationships.

properties

INTEGER

The number of exported properties.

time

INTEGER

The duration of the export.

rows

INTEGER

The number of rows returned.

batchSize

INTEGER

The size of the batches the export was run in.

cypherStatements

ANY

The executed Cypher Statements.

nodeStatements

ANY

The executed node statements.

relationshipStatements

ANY

The executed relationship statements.

schemaStatements

ANY

The executed schema statements.

cleanupStatements

ANY

The executed cleanup statements.

Usage Examples

The examples in this section are based on a database that has applied the following constraints:

CREATE CONSTRAINT personName FOR (person:Person)
REQUIRE person.name IS UNIQUE;

CREATE CONSTRAINT userId FOR (user:User)
REQUIRE user.id IS UNIQUE;
CALL apoc.export.cypher.schema()
YIELD format, time, cypherStatements
RETURN format, time, cypherStatements;
Results
format time cypherStatements

"cypher"

1

":begin CREATE CONSTRAINT FOR (node:Person) REQUIRE (node.name) IS UNIQUE; CREATE CONSTRAINT FOR (node:User) REQUIRE (node.id) IS UNIQUE; :commit CALL db.awaitIndexes(300); "