cancel
Showing results for 
Search instead for 
Did you mean: 

Cypher query Issue

JSENL
Node

Neo4j Desktop 1.2.0
Neo4j 3.5.1
Neo4j Browser 3.5.6
code used:
LOAD CSV WITH HEADERS FROM "file:C:\Users\jlambright.Neo4jDesktop\neo4jDatabases\database-<#>\installation-3.5.6\import\test.csv" AS line
MERGE (n:MyNode {Name:line.Source})
MERGE (m:MyNode {Name:line.Target})
MERGE (n) -[:TO {dis:line.distance}]-> (m)

error message:
Neo.ClientError.Statement.SyntaxError: Invalid input 's': expected four hexadecimal digits specifying a unicode character (line 1, column 38 (offset: 37))
"LOAD CSV WITH HEADERS FROM "file:C:\Users\jlambright.Neo4jDesktop\neo4jDatabases\database-<#>\installation-3.5.6\import\test.csv" AS line"

I have an import folder and moved the file in there,
I have the dbms.security.allow_csv_import_from_file_urls=true uncommented

Not sure what else I need to fix for the CSV to import.

3 REPLIES 3

If you have moved the CSV file to the import folder, then you load should be:

LOAD CSV WITH HEADERS FROM 'file:///test.csv' as line

It sounds like you have a rogue character in the CSV file. Before you actually create nodes in the database, you should first examine the data (RETURN line).

Elaine

The \ character is an escape character in Java strings, and this is causing all kinds of problems here. The first one is \U which indicates the next four digits are hex meant to specify a unicode character. You're going to get an error for every additional occurrence of \ in your path string.

I think you can just use /, the forward slash, instead, and that should work. Otherwise, you'll need to escape the backslash with another backslash \\ in every occurrence in the string.

ameyasoft
Graph Maven

Since the file is in import folder, try this:

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

This works for me.