Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

add a json option to cypher shell's --format argument #166

Open
eastlondoner opened this issue Sep 10, 2019 · 1 comment
Open

add a json option to cypher shell's --format argument #166

eastlondoner opened this issue Sep 10, 2019 · 1 comment

Comments

@eastlondoner
Copy link

eastlondoner commented Sep 10, 2019

This would allow for scripting cypher shell with jq.
Currently scripting with cypher is extremely onerous because it's necessary to

  1. strip out headers
  2. split output rows into columns
  3. remove quotes around columns
  4. deal with the character escaping applied to the contents of columns
@eastlondoner
Copy link
Author

for example to pipe the cypher shell output of apoc.export.cypher back in to cypher shell I need this:

sed 's/^":/:/' | sed 's/^"$/:/' | sed 's/\\"/"/g' | sed 's/^:$//' | tail -n +2 \

and that's with well behaved data (no weird string values in)

as in

cypher-shell --format plain -u neo4j -p "${neo4j_password}" "call apoc.export.cypher.all(null,{format:'cypher-shell', streamStatements:true, batchSize:100, useOptimizations: {type: 'unwind_batch_params', unwindBatchSize:100}}) YIELD cypherStatements RETURN cypherStatements" \
 | sed 's/^":/:/' | sed 's/^"$/:/' | sed 's/\\"/"/g' | sed 's/^:$//' | tail -n +2 \
 | ./bin/cypher-shell --non-interactive --format plain -a bolt+routing://${other_neo4j_address} -u neo4j -p "${other_neo4j_password}"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant