3

Following query works fine for me

CALL apoc.export.csv.query("MATCH (a:Person)
RETURN a.name AS name", "result.csv", {})

but i want to export the result to a specific directory e.g in 'test' directory /neo4j-community-3.2.6/test/result.csv

Test directory exists in neo4j-community-3.2.6 folder, but the query

CALL apoc.export.csv.query("
    MATCH (a:Person)
    RETURN a.name AS name",
"/test/result.csv", {})

gives me following error:

Neo.ClientError.Procedure.ProcedureCallFailed Failed to invoke procedure apoc.export.csv.query: Caused by: java.io.FileNotFoundException: \test\result.csv (The system cannot find the path specified)

Can any one help?

Bruno Peres
  • 15,845
  • 5
  • 53
  • 89
Faaiz
  • 635
  • 8
  • 18
  • The first query is putting the file in what directory? – Bruno Peres Oct 13 '17 at 16:32
  • Thanks for your response. It was putting the result.csv in /neo4j-community-3.2.6 directory. And i wanted to put into a sub-directory neo4j-community-3.2.6/test – Faaiz Oct 13 '17 at 16:41
  • See also this [related issue](https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/609) about relative paths. – Gabor Szarnyas Oct 13 '17 at 17:49

2 Answers2

3

It is resolved. I got help from "neo4j-users.slack.com" by user "tomasi". For this we need to provide the complete path in the parameter:

CALL apoc.export.csv.query("MATCH (a:Person)
    RETURN a.name AS name",
"/home/xyzuser/neo4j-community-3.2.6/test/result.csv", {})
Bruno Peres
  • 15,845
  • 5
  • 53
  • 89
Faaiz
  • 635
  • 8
  • 18
0

The files are saved in bin folder by default. Give file location as '../test/result.csv' might work. Worked in my case