How to export to .csv with Neo4j APOC including relationship ID

Viewed 837

Recently I have been using Neo4j for a project for a course I'm following. I've figured out how to use APOC to export my database to .csv.

However, the exported .csv file does not include the relationship ID. I use the following call to export the database:

CALL apoc.export.csv.all("export.csv",{})

I can also use the following Cypher query to obtain the relationship ID's:

MATCH ()-[r]-() RETURN ID(r)

There exists an apoc.export.csv.query() but I cannot think of a query that contains the information that is contained in the apoc.export.csv.all call and also contains the relationship ID.

I could potentially request the ID's separately and put them into export.csv using a Python script, but I'm not sure whether the order of the relationships would be the same for the separate calls/queries.

Any help is greatly appreciated!

1 Answers
Related