简体   繁体   English

在NEO4J中导入csv文件

[英]import csv file in NEO4J

I'm on windows 7 and I'm new to Neo4J, I'm using Neo4J version 3.0.3. 我在Windows 7上,是Neo4J的新手,我使用的是Neo4J版本3.0.3。 I have a simple and small csv file, just for trying out how to import a csv file into Neo4j. 我有一个简单的小型csv文件,仅用于尝试如何将csv文件导入Neo4j。

Here is my file, called people.csv 这是我的文件,名为people.csv

1,"John"
10,"Jane"
234,"Fred"
4893,"Mark"
234943,"Anne"

From neo4j browser's console I've tried in different ways to import this file but got no luck. 从neo4j浏览器的控制台,我尝试了不同的方法来导入此文件,但是没有运气。 These are my attempts: 这些是我的尝试:

    USING PERIODIC COMMIT 10000 LOAD CSV FROM "file:///C:\Utenti\Luca\Desktop\people.csv"

which returned this error: Invalid input 't': expected four hexadecimal digits specifying a unicode character (line 1, column 56 (offset: 55))
"USING PERIODIC COMMIT 10000 LOAD CSV FROM "file:///C:\Utenti\Luca\Desktop\people.csv""

Then I tried with slashes. 然后我尝试用斜杠。

    USING PERIODIC COMMIT 10000 LOAD CSV FROM "file:///C:/Utenti/Luca/Desktop/people.csv"

and the error was:
Unexpected end of input: expected whitespace, '.', node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR or AS (line 1, column 86 (offset: 85))
"USING PERIODIC COMMIT 10000 LOAD CSV FROM "file:///C:/Utenti/Luca/Desktop/people.csv""

The path in your second query looks correct. 您第二个查询中的路径看起来正确。 But you LOAD the csv file without doing anything. 但是您无需执行任何操作即可LOAD csv文件。

The error tells you that it expects something after the first line (column 86 is the end of line). 该错误告诉您,它期望在第一行之后出现某些情况 (第86列是行的结尾)。

Try eg to return the first few lines: 尝试例如返回前几行:

USING PERIODIC COMMIT 10000
LOAD CSV FROM "file:///C:/Utenti/Luca/Desktop/people.csv" AS line
WITH line
RETURN line
LIMIT 5

If you want to create something, read the manual: http://neo4j.com/docs/developer-manual/current/#query-load-csv 如果要创建内容,请阅读手册: http : //neo4j.com/docs/developer-manual/current/#query-load-csv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM