I'm running some Neo4j cypher queries using neo4j-shell
. They have long execution times as I am importing large CSV files.
I would like to output some messages to the console as each stage of the import completes, so that we can see the import progress at run-time without having to wait for the execution to complete.
I've checked the Cypher RefCard and can't find an example of this. Does cypher support outputting to the shell console window?
I find it a really interesting topic. IMO the best way to achieve it in a powerful way is to write a server plugin :
You create a TransactionEventHandler that implements the TransactionEventHandler interface
You receive a TransactionData which represents what has been changed during the transaction
You can transform the changes into json
and finally write them to the logs
activate the logs in the appenders
The "Return" string is printed twice since the first is the header, and the second is the content. You can use "AS" with backticks to change the header to make it look better:
MATCH (n)
DETACH DELETE n;
RETURN "Existing data removed" AS `Action:`;
Even better, you can combine the operation output with the message:
MATCH (n)
DETACH DELETE n
RETURN count(n) AS `Existing data removed:`;
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