首页 > 数据库 >导入数据到neo4j数据库

导入数据到neo4j数据库

时间:2022-09-29 11:23:08浏览次数:52  
标签:数据库 toInteger 导入 student neo4j line csv id

首先去MySQL端通过SQL把数据导出 .csv 格式的文件。

记得去掉 .csv 数据文件里数据上的引号。

sed -i 's/"//g' 1.csv

 

然后把 .csv 数据文件放到 import 目录里:/data/neo4j/neo4j-community-4.4.10/import/

 

登录客户端

/usr/local/jdk-11.0.16.1/bin/java -jar /data/neo4j/neo4j-community-4.4.10/bin/tools/cypher-shell.jar

输入账号/密码,默认是 neo4j/neo4j。

load csv with headers from 'file:///1.csv' as line match (s:WhStudent {student_id:toInteger(line.student_id)}) ,(p:WhArticle{article_id:toInteger(line.attr_id) }) where s.student_id = toInteger(line.student_id) and p.article_id = toInteger(line.attr_id)  merge (s)-[r:Like{created_at:toInteger(line.created_at),updated_at:toInteger(line.updated_at),is_vest:toInteger(line.is_vest)}]->(p);

 

标签:数据库,toInteger,导入,student,neo4j,line,csv,id
From: https://www.cnblogs.com/zhouwanchun/p/16740847.html

相关文章