Ram
Ram

Reputation: 97

Unable to export query results as csv in neo4j

I have an employee database with 1800 employees and 45000 messages in between them. I am trying to export the results of the following query into a csv file by clicking the export option in the neo4j browser.

LOAD CSV WITH HEADERS FROM 
'file:///employees.csv' AS line 
WITH line
MATCH(e:Employee{pkey:line.profile_key})-[r:Message]->(b:Employee) RETURN 
e.pkey, b.pkey, COUNT(r)
ORDER BY e.pkey;

But its not working. I only get the initial 100 rows.I have also changed the number of rows to 10000 in the browser settings, but then again after the execution of the query my browser stops responding and closes automatically. I am using neo4j community edition 3.2.1 on windows. Is there any other way to export the results other than the browser option in windows? Thanks in advance!

Upvotes: 0

Views: 1108

Answers (1)

Tom Geudens
Tom Geudens

Reputation: 2656

You might want to use the APOC procedures and run them from the Cypher shell. Example :

neo4j> CALL apoc.export.csv.query("MATCH(p:Part) RETURN p.name","/var/tmp/parts.csv", {});

This does require you to setup the apoc plugin and add the following parameter to neo4j.conf

apoc.export.file.enabled=true

Hope this helps, Tom

Upvotes: 2

Related Questions