0
votes

I want to use the neo4j-shell-tools https://github.com/jexp/neo4j-shell-tools because my desired output is a CSV file. With a single Cypher command, this works great, e.g.,

neo4j restart
neo4j-shell

import-cypher -o out.csv match (p) return count(p) as count

However, I actually have a large number of cypher commands saved in a .cql file that I'd like to run. So long as I don't want to export as a CSV file, I can do so via

neo4j-shell -file neatStuff.cql

However, I haven't been able to find a way to combine these, that is, using import-cypher to export the results of a file's worth of Cypher commands.

Does anyone know if this is possible and, if so, how it would be best done? Thank you.

1

1 Answers

0
votes

If using multiple commands is not an issue, you can use a pipe. This works on both Unix-based and Windows systems.

echo 'import-cypher -o out.csv match (p) return count(p) as count' | bin/neo4j-shell
neo4j-shell -file neatStuff.cql

Note: the openCypher style guide recommends the .cypher extensions. If you would like to keep is short, use .cyp as .cql is the extensions for the Cassandra Query Language.

Update: as pointed out by the OP in the comments, the latest version of APOC provides apoc.export.csv.* methods.