Export Millions of Data on Neo4j to CSV, JSON with Official Drivers

Hello , i'm using a lot of official drivers from Neo4j, i use the Java Driver, Python Driver, and Javascript Driver, so i need that when ask for a Query like

MATCH (n:Client) return n.name , n.address, n.clientNumber

i can return the results into a CSV , in python i get the result of the query and get record by record and then add to a CSV file with native python libraries.

Is there an function in one of the official drivers that i can export this data easy to a CSV or JSON without previous treatmentof the data ?

CALL apoc.periodic.iterate("MATCH (n:Client) return n",
"CALL apoc.export.json.query('UNWIND $_batch as row with row.n as cli RETURN {name:cli.name,address:cli.address,clientNumber:cli.clientNumber} as map','/export_data/test-json-export-' + $_count+'.json',{useTypes:true, storeNodeIds:false,params:{_batch:$_batch}}) YIELD nodes return sum(nodes)",{batchSize:100000,iterateList:true,parallel:true,concurrency:20});

This will export files that are 100k in length, exporting them in parallel using APOC. Follow instructions online to use APOC and its exports, should be an easy google search.

1 Like