Hi!
I had lots of luck posting here last time so I thought I'd give it another shot. I'm trying to look into how to batch schema operations. I currently batch operations with apoc.periodic.iterate and then run apoc.cypher.doIt, as the iterator. This has worked great up until now but I'm looking to batch schema operations.
I started seeing the following error:
Error: org.neo4j.graphdb.QueryExecutionException: Schema operation 'create_constraint' on database 'neo4j' is not allowed for user '' with FULL overridden by TOKEN_WRITE overridden by TOKEN_WRITE.
After digging into it, it looks like apoc.periodic.iterate can only accept non-schema operations as the queries that it runs. I switched apoc.cypher.doIt
to apoc.cypher.runSchema
and it produces the same error.
I've tried a couple other things like using apoc.periodic.runMany
and separating each schema operation statement with a semicolon but no luck there and running multiple schema operation statements in a single query without a procedure/function.
For reference, these are the types of queries that I wish to batch in one call to the neo4j DB:
CREATE CONSTRAINT IF NOT EXISTS FOR (model:modelName1) REQUIRE model.property IS UNIQUE
CREATE CONSTRAINT IF NOT EXISTS FOR (model:modelName2) REQUIRE model.property IS UNIQUE
CREATE CONSTRAINT IF NOT EXISTS FOR (model:modelName3) REQUIRE model.property IS UNIQUE
etc...
Any suggestions would be greatly appreciated!