cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Import from CSV: Null Error on Non Null Value

I'm new to neo4j and haven't read through all the docs but from what I've read on load csv it seems like I have formatted my csv correctly and the statement is taken directly from one of the docs. I'm sure I'm doing something wrong but just too new to know what that is.

Issue Description:

When testing a simple csv load I get a null error even though there are no rows with empty values. Can someone suggest the obvious thing I'm missing?

Cypher Load

</>
LOAD CSV WITH HEADERS FROM 'file:///WikiPage.csv' AS row
MERGE (c:WikiPage {id: row.page_id, title: row.page_title})
</>

Error Message
</>

Neo.ClientError.Statement.SemanticError

Neo.ClientError.Statement.SemanticError: Cannot merge node using null property value for id
</>

Please provide the following information if you ran into a more serious issue:

  • neo4j version, desktop version, browser version
    3.5.6 Community, Windows 10, Chrome Version 76.0.3809.100 (Official Build) (64-bit)

  • what kind of API / driver do you use
    Cypher Import from CSV

  • screenshot of PROFILE or EXPLAIN with boxes expanded (lower right corner)

  • a sample of the data you want to import
    WikiPage.csv
    page_title,page_id:int
    foo,1
    bar,2

links_to.csv
f_id:int,t_id:int
1,2

  • which plugins / extensions / procedures do you use
    Cypher Load CSV

  • neo4j.log and debug.log

1 ACCEPTED SOLUTION

I figured it out, I was using the header format for the import tool and not the cypher import statement. Updated the header without the type declaration and then used toInteger in the cypher command, loading just fine now.

LOAD CSV WITH HEADERS FROM 'file:///WikiPage.csv' AS row
MERGE (c:WikiPage {id: toInteger(row.page_id), title: row.page_title})

LOAD CSV WITH HEADERS FROM 'file:///links_to.csv' AS row
MATCH (f:WikiPage {id: toInteger(row.f_id)}),(t:WikiPage {id: toInteger(row.t_id)})
CREATE (f)-[:links_to]->(t)

View solution in original post

1 REPLY 1

I figured it out, I was using the header format for the import tool and not the cypher import statement. Updated the header without the type declaration and then used toInteger in the cypher command, loading just fine now.

LOAD CSV WITH HEADERS FROM 'file:///WikiPage.csv' AS row
MERGE (c:WikiPage {id: toInteger(row.page_id), title: row.page_title})

LOAD CSV WITH HEADERS FROM 'file:///links_to.csv' AS row
MATCH (f:WikiPage {id: toInteger(row.f_id)}),(t:WikiPage {id: toInteger(row.t_id)})
CREATE (f)-[:links_to]->(t)