Apoc export csv

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"

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.