apoc.export.cypher.schema

Procedure APOC Core

apoc.export.cypher.schema(file,config) - exports all schema indexes and constraints to cypher

Signature

apoc.export.cypher.schema(file =  :: STRING?, config = {} :: MAP?) :: (file :: STRING?, batches :: INTEGER?, source :: STRING?, format :: STRING?, nodes :: INTEGER?, relationships :: INTEGER?, properties :: INTEGER?, time :: INTEGER?, rows :: INTEGER?, batchSize :: INTEGER?, cypherStatements :: STRING?, nodeStatements :: STRING?, relationshipStatements :: STRING?, schemaStatements :: STRING?, cleanupStatements :: STRING?)

Input parameters

Name Type Default

file

STRING?

config

MAP?

{}

Output parameters

Name Type

file

STRING?

batches

INTEGER?

source

STRING?

format

STRING?

nodes

INTEGER?

relationships

INTEGER?

properties

INTEGER?

time

INTEGER?

rows

INTEGER?

batchSize

INTEGER?

cypherStatements

STRING?

nodeStatements

STRING?

relationshipStatements

STRING?

schemaStatements

STRING?

cleanupStatements

STRING?

Usage Examples

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

CREATE CONSTRAINT personName ON (person:Person)
ASSERT person.name IS UNIQUE;

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

"cypher"

1

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