如何导入csv数据以在neo4j中创建具有指定属性的节点

时间:2014-10-13 06:14:40

标签: neo4j cypher graph-databases

我必须使用以下CSV数据创建30多个节点作为属性

  id,name,skill,cur_company,pre_company,college,location

  1,"pavan","java","CGI","CSC","JNTU","HYDERABAD"

  2,"ravi","java","TCS","CSC","SGPL","DELHI"

  ...

如何通过导入上述数据来创建节点。等,

u1:User {id:1,name:"pavan",skill:"java",cur_company:"CGI",prev_company:"CSC",location:"HYDERBAD"}

u2:User {id:2,name:"ravi",skill:"java",cur_company:"TCS",prev_company:"CSC",location:"DELHI"}

2 个答案:

答案 0 :(得分:1)

Cypher中有一个专用的LOAD CSV命令:

load csv with headers from "file-url" as data
create (u:User {data}}

load csv with headers from "file-url" as data
create (u:User {id:data.id, name:data.name, ....}}

答案 1 :(得分:-1)

在应用上述命令之前,请在neo4j.conf文件中进行以下更改:

评论#dbms.security.allow_csv_import_from_file_urls=true行 和 取消注释dbms.directories.import=import