Hi_there
Hi_there

Reputation: 41

Loading CSV Neo4j "Neo.ClientError.Statement.SemanticError: Cannot merge node using null property value for Test1'"

I am using grades.csv data from the link below,

https://people.sc.fsu.edu/~jburkardt/data/csv/csv.html

I noticed that all the strings in the csv file were in "" and it causes

error messages: Neo.ClientError.Statement.SemanticError: Cannot merge node using null property value for Test1

so I removed the "" in the headers

the code I was trying to run:

LOAD CSV WITH HEADERS FROM 'file:///grades.csv' AS row MERGE (t:Test1 {Test1: row.Test1}) RETURN count(t); error message:

Neo.ClientError.Statement.SyntaxError: Type mismatch: expected Any, Map, Node, Relationship, Point, Duration, Date, Time, LocalTime, LocalDateTime or DateTime but was List<String> (line 2, column 24 (offset: 65)) "MERGE (t:Test1 {Test1: row.Test1})

Upvotes: 0

Views: 245

Answers (2)

cybersam
cybersam

Reputation: 66989

The issues are:

  1. The file is missing a comma after the Test1 value in the row for "Airpump".
  2. The file has white spaces between the values in each row. (Search for the regexp ", +" and replace with ",".)

Your query should work after fixing the above issues.

Upvotes: 0

Rajendra Kadam
Rajendra Kadam

Reputation: 4052

Basically you can not merge node using null property value. In your case, Test1 must be null for one or more lines in your file. If you don't see blank values for Test1, please check is there is any blank line at the end of file.

You can also handle null check before MERGE using WHERE, like

LOAD CSV ... 
WHERE row.Test1 IS NOT NULL
MERGE (t:Test1 {Test1: row.Test1})
RETURN count(t);

Upvotes: 1

Related Questions