且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将较大的csv文件加载到Neo4j中

更新时间:2023-01-09 17:55:52

我通过复制有限行的解决方案此处

I Solved the problem by copying the solution for limited row here

所以这是我的解决方案:

so this is my solution:

USING PERIODIC COMMIT
load csv with headers from "file:///train.csv" as line
with line LIMIT 1458644
create   (pl:pickup_location{latitude:toFloat(line.pickup_latitude),longitude:toFloat(line.pickup_longitude)}),(pt:pickup_time{pickup:line.pickup_datetime}),(dl:dropoff_location{latitude:toFloat(line.dropoff_latitude),longitude:toFloat(line.dropoff_longitude)}),(dt:dropoff_time{dropoff:line.dropoff_datetime})
create (pl)-[:TLR]->(pt),(dl)-[:TLR]->(dt),(pl)-[:Trip]->(dl);

该解决方案的缺点是您需要知道大型csv文件的行数( excel 无法打开大型csv文件。

the downside of this solution is that you need to know the number of rows of your big csv file (excel can't open large csv files).