简体   繁体   中英

import csv file in NEO4J

I'm on windows 7 and I'm new to Neo4J, I'm using Neo4J version 3.0.3. I have a simple and small csv file, just for trying out how to import a csv file into Neo4j.

Here is my file, called 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. 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.

The error tells you that it expects something after the first line (column 86 is the end of line).

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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