How to output/import cypher queries result in a csv file?

(Shatadrusaha) #1


I had been using Neo4j comunity eidtion 3.0.0 In the previous version, I used to execute multiple cypher queries and output the results in individual csv files. Due to some reason, the installation was corrupted and I can't find the older version. So, I installed the latest verion of Neo4j 3.5.3

I want to know, how do I achieve the same result now? I have a '.cql' file, which has multiple cypher queries. How do I save the results of each cypher queries in individual csv files? In the previous version I had used "neo4j-shell.bat" to import the results. But in the current versions, this is not supported.

Previouly I used the following cypher command to get the results in a csv, in a cql file:

import-cypher -d"," -o E:/Graph_Database/Results/policy.csv MATCH (pol:Pol)-[r:IS_PHL]->(), (pol:Pol)-[r2:POLICY_FOR]->(veh:Veh) WHERE pol.Misc_Sls_Date >= '2019-02-19' WITH COLLECT(r2.Underwriter) AS Underwriter, pol, COLLECT(DISTINCT(r.Credit_MatchStatus)) AS Match_Status RETURN pol.Policy_number AS Policy_#, CASE WHEN pol.Policy_Canceled = '0' THEN 'Active' ELSE 'Cancelled' END AS Policy_Status, CASE WHEN pol.Fraud = '1' THEN 'Yes' ELSE 'No' END AS Fraud, pol.Misc_Sls_Date AS Sale_Date, Underwriter, Match_Status, pol.Brand AS Brand;

Looking forward for your help.