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.

Exported file location

intouch_vivek
Graph Steward

Hi ,

I am using Desktop version of Neo4j and need to export my query output file at d:/movies-directed.csv
With<Match n()-[rel]-<(m)> as query
CALL apoc.export.csv.query(query, "d:/movies-directed.csv", {})
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data

this is throwing error
Failed to invoke procedure apoc.export.csv.query: Caused by: java.io.FileNotFoundException: \import\D:\movies-directed.csv (The filename, directory name, or volume label syntax is incorrect)
regards
Vivek

8 REPLIES 8

MuddyBootsCode
Graph Steward

Make sure you have export enabled in settings. You can find some examples here https://neo4j.com/docs/labs/apoc/current/export/csv/

yes it is already enabled. Infact when I set

apoc.import.file.use_neo4j_config=false

then error message changed to
Failed to invoke procedure apoc.export.csv.query: Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: D:\movies-directed.csv

MuddyBootsCode
Graph Steward

I think this is what you meant:

apoc.export.file.enabled=true

apoc.export.file.enabled=true
apoc.import.file.use_neo4j_config=false
both are set

MuddyBootsCode
Graph Steward

It looks like from the error message that it's still trying to write to the import directory. Is that we're you're trying to write the file? It may require a restart of the instance to set the changes or they may not have been saved. Other than that, you may want to have use an explicit file path rather than the relative one.

I have giving explicit path. D:/abc/abc.csv, however I feel the problem is the colon sign after D.
I guess this feature is not enabled for Windows Desktop version.

MuddyBootsCode
Graph Steward

I've seen it done like D:/// in the import documentation. It might work that way.

It did not work.

I have following setting at docker compose file
environment:
- NEO4J_dbms_security_procedures_unrestricted=apoc.*
- NEO4J_apoc_import_file_enabled=true
- NEO4J_dbms_shell_enabled=true
- NEO4J_AUTH=neo4j/agilion2018!
- NEO4J_HEAP_MEMORY=4G
- NEO4J_CACHE_MEMORY=2G
- NEO4JLABS_PLUGINS=["apoc", "graph-algorithms"]
- NEO4J_apoc_export_file_enabled=true
- NEO4J_apoc_import_file_use_neo4j_config=false

Cypher:
With "Match (p:Person)-[rel1:BELONG_TO]->(b:Book)
Return p,b" as query
CALL apoc.export.csv.query(query, "/var/lib/pb.csv", {})
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data

Error:
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.export.csv.query: Caused by: java.io.FileNotFoundException: /import/var/lib/pb.csv (No such file or directory)