ow-me
ow-me

Reputation: 161

Error import csv in NEO4J

I'm following this guide to create a graph dataset. Now I have to import a CSV file in Neo4j. To do this I'm using this script where I have edited only the paths to the CSV file.

When I execute it in Neo4j shell I get this error:

Neo.ClientError.Statement.SyntaxError: Invalid input 'R': expected 'e/E' 
(line 23, column 2 (offset: 1116))
"DROP CONSTRAINT ON (a:PERSON) ASSERT a.number IS UNIQUE;"

Also, these lines are underlined with error:

extraneous input

ON CREATE SET a.first_name = line.FIRST_NAME, a.last_name = line.LAST_NAME, 
a.full_name = line.FULL_NAME
ON MATCH SET a.first_name = line.FIRST_NAME, a.last_name = line.LAST_NAME, 
a.full_name = line.FULL_NAME
...
ON CREATE SET c.start = toInt(line.START_DATE), c.end= toInt(line.END_DATE), 
c.duration = line.DURATION
MERGE (d:LOCATION {cell_tower: line.CELL_TOWER})
ON CREATE SET d.address= line.ADDRESS, d.state = line.STATE, d.city = 
line.CITY
...

Instead, this line gets this error message:

Missing ';' at DROP

DROP CONSTRAINT ON (a:PERSON) ASSERT a.number IS UNIQUE;

Upvotes: 1

Views: 692

Answers (2)

ow-me
ow-me

Reputation: 161

  1. Adding ID field in dataset
  2. rename field "cell_site" in "cell_tower" in dataset
  3. Open .conf file and allow to load file from everywhere
  4. execute istructions in block, not in the same command.

Upvotes: 0

Bruno Peres
Bruno Peres

Reputation: 16355

First, you should put your CSV file in the Neoj4 import directory. If you are using a Windows desktop community edition version, this directory is %APPDATA%\Neo4j Community Edition\import (see file location docs).

Then change your LOAD CSV statement to:

LOAD CSV WITH HEADERS FROM "file:///call_records_dummy.csv" AS line

Upvotes: 2

Related Questions