I am working on windows. I have created a text file of Cypher query using notepad. How can I run the query in the file using Neo4jShell or Neo4j web interface console.
A command line shell where you can execute Cypher against an instance of Neo4j. By default the shell is interactive but you can use it for scripting by passing cypher directly on the command line or by piping a file with cypher statements (requires Powershell on Windows).
Use the keyboard shortcut Command + Option + J (Mac) or Control + Shift + J (Windows/Linux).
You can use cypher-shell to populate the default database by sending pre-written Cypher statements to the database to execute. Here we have download a file named movies. cypher that contains the Cypher statements to create the Movie graph.
Running Cypher Shell within the Neo4j distribution Note that Cypher queries must end with a semicolon.
On Debian/Ubuntu or any *nix installations, use the following from terminal:
$ neo4j-shell -c < path-to-cypher-query-file.cql
Note that each cypher query in the file must end in a semicolon and must be separated by a blank line from the other query. Also, the .cql
ending (file format) is not mandatory.
Just add -file
as a parameter when starting the console.
On windows, it would look like this :
Neo4jShell.bat -file path/to/cql/file
Or you could also print the result into a new file
Neo4jShell.bat -file path/to/cql/file > path/to/output/file
I'm also sure there is a way to do it from within the shell and not at startup, as it was once demonstrated to me by Stefan Armbruster but for the love of god, I can't remember how he did it. But this approach works as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With