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.

Apoc export csv

tideon
Graph Buddy

have been experimenting with apoc export option. The following code keeps giving an error for which I have no clue what to fix


CALL apoc.export.csv.query("MATCH (t:Toy) WHERE t.ProductName IS NULL","nameless.csv",{})
YIELD rows
RETURN rows

The error is


Failed to invoke procedure `apoc.export.csv.query`: Caused by: org.neo4j.exceptions.SyntaxException: Query cannot conclude with MATCH (must be RETURN or an update clause) (line 1, column 1 (offset: 0))
"MATCH (t:Toy) WHERE t.ProductName IS NULL"
1 REPLY 1

akaur
Node Link

Hi @tideon

It states that you need to add return value within your query itself. The apoc.export.csv.query procedure exports the results of a Cypher query to a CSV file. In your case, Cypher is unable to get the results of query.

Try this:
CALL apoc.export.csv.query("MATCH (t:Toy) WHERE t.ProductName IS NULL return t.ProductName","nameless.csv",{})
YIELD rows
RETURN rows

It should work. Good Luck.