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.

Table view output with cypher-shell

Hello there,

With neo4j desktop, we can see the outputs with either Table view and Text view.

I find the Table output to be much richer than Text view, since it provides information such as identity, start, end. I need those information to reconstruct the graph programmatically.

Is there a way to generate Table view output with cypher-shell?

3 REPLIES 3

You could place your query in a file and use cypher-shell to execute it and write the results to a file. By default, the output will be comma delimited. Here is the syntax I tested with, where test.cypher had my cypher and the output saved to result.txt. You can process the comma delimited file as a csv file or a plan text file. 

cypher-shell -u <username> -p <password> -f test.cypher > result.txt

Thanks for the proposition @glilienfield 

However, the output is still missing all the IDs for the relationships & nodes.

It is the same output as the Text view in neo4j desktop - I want the Table view instead.

Table view example of a relationship data:

{
"identity": 5017,
"start": 503,
"end": 504,
"type": "LINKED",
}

I am after the identity/start/end fields. For some reason they are not showing up in Text view format.

you can write the query to format the data in any manner you need. You can product that output with a query like this:

match()-[r]->()
return {id: id(r), start: id(startNode(r)), end: id(endNode(r)), type: 
type(r)} as relationship

Sample of one row from my database:

{
  "start": 1,
  "end": 2,
  "id": 206,
  "type": "REL"
}