cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Ability to execute "batch queries" via a .cql or .cypher file from embedded java

Does anyone know if its possible to execute .cql or .cypher files programmatically in embedded java mode as sort of a "batch" operation? I have numerous queries in a .cql file that I'd like to use whenever I spin up a new database using something like transactions in java: https://neo4j.com/docs/java-reference/current/tutorials-java-embedded/#tutorials-cypher-java . All I see is you can manually type out the query as a parameter but I was hoping there was functionality to pass an entire file.

1 REPLY 1

You can split the file by a Semicolon at the end of the line.
And then execute each of those parts with db.execute(statement)

java.util.Scanner works well for that, that's what I use in APOC's apoc.cypher.runFile too.