neo4j load csv导入第一个中的所有列

时间:2014-07-17 09:31:47

标签: csv neo4j

我尝试使用LOAD CSV Cyper语句将一个csv文件导入Neo4j。在我看到here时,检查线条可能很有用。我正在使用Windows(我使用的是Neo4j 2.1版本)所以我有以下查询

    LOAD CSV WITH HEADERS FROM "file:C:/Users/Neo4j/Worldcup_2014.csv" AS line 
    WITH line LIMIT 5 RETURN line.world_cup, line.a_score;

我得到的结果不是我预期的,因为在world_cup(这是第一列)中有整行的内容:

    world_cup,id,home,away,h_score,a_score,new_match_number,date,time,stadium,phase,year,host
    "2014 FIFA World Cup Brasiliaâ„¢","3000614541","Brazil","Croatia","3","1","1","12/06/2014","22:00",""Sao Paulo / Sao Paulo"","Group matches","2014","Brazil"
    "2014 FIFA World Cup Brasiliaâ„¢","3000614542","Mexico","Cameroon","1","0","2","13/06/2014","18:00",""Natal / Estádio das Dunas"","Group matches","2014","Brazil"

我想要返回的所有其他字段都具有值null

我已尝试使用FIELDSEPARATOR ','但它没有效果!我该怎么做才能得到正确的结果?

1 个答案:

答案 0 :(得分:0)

此命令适用于我,使用来自“file:/Users/lalitazad/Documents/exports/usertable.csv”的标题加载csv作为csvline,csvline limit 1 create(:user {id:csvline.id});

在我的csv文件系统中的位置。我想在node4j中创建一个节点。此外,您可以删除限制,并可以导入所有记录

我忘了添加,csv包含列名的id,我只是创建一个节点,其中一个字段为id;