neo4j导入csv数据的路径问题
2019-03-13 本文已影响0人
redcohen
在浏览器环境进行交互查询,导入本地CSV文件时,
![](https://img.haomeiwen.com/i13183423/146352120bdf3530.png)
记得这样做:
1) 找到安装neo4j的目录下,类似import的子目录。比如,在我的mac上:
/Users/redcohen/Documents/study/neo4j-enterprise-3.5.3/import
把要load的文件放进去,比如:data.csv
/Users/redcohen/Documents/study/neo4j-enterprise-3.5.3/import/data.csv
- 在代码中一定记得'///',如下示例:
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///data.csv" AS row
CREATE (n:User)
SET n = row
...
其实在neo4j的官方文档中说的很清楚了:
参看:Importing CSV Data into Neo4j
节选如下:
File-URLs
- Make sure to use the right URLs for files:
file:///data.csv
orhttps://host/path/data.csv
The file URLs are relative to the import directory (for location of the import directory refer to the Neo4j Operations Manual). - Use
bin/cypher-shell
instead of the browser for better control. By default it connects to the database running on localhost but you can point it to a database anywhere over the network.