cancel
Showing results for 
Search instead for 
Did you mean: 

apoc.periodic.iterate with apoc.export.csv.data

Hi there,

             I am using this query to export particular Node data to csv using apoc.periodic.iterate. But getting error.

Please look at the query and do suggest.

MATCH (nod:${node}) WITH collect(distinct nod) as a
CALL apoc.periodic.iterate(
 
'CALL apoc.export.csv.data(a,[],"person.csv", {})
RETURN distinct testFile, nodes, relationships, properties, data'
,{batchSize:10000, parallel:true,params:{nod:a}}) YIELD batches RETURN batches`)
6 REPLIES 6

glilienfield
Ninja
Ninja

What is the error?

In the meantime, a couple of observations:

 

CALL apoc.periodic.iterate(
'MATCH (nod:${node}) WITH collect(distinct nod) as a RETURN a',
'CALL apoc.export.csv.data(a,[],"person.csv", {})
YIELD file, nodes, relationships, properties, data
RETURN distinct file, nodes, relationships, properties, data'
,{batchSize:100}) YIELD batch,operations RETURN batch,operations`);
 
Now Query Get Executed but there is no batch work.

ThomasVarias
Node Clone

Just thinking out loud here... how is a multi-threaded export going to work? Halving multiple threads writing to the same file sounds like a bad idea to me.  Please keep in mind that I haven't tried this at all, ymmv.

Thomas

I agree with @ThomasVarias, this doesn’t seem to make sense. You did remove the parallel execution, but now it will probably just overwrite the existing export and create a new one. You probably would need to append a unique identifier to the end of the file name so a new file is created each time. Are you intending to generate the export across multiple files? Have you tried exporting the data directly without the periodic iterate? 

Yes i have tried it works well. I need to migrate data from neo4j to mongoDB. And it is one time process. Is it the right way i am doing saving data in CSV file and then do the further process or something else i can try to migrate data.

Neo4j Data is near about 10 GB, is it the right way by using apoc procedure

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.