Blog Post

Working with Neo4j Imports–I HATE CASE SENSITIVITY

,

I’ve been working to better understand graph databases and where they can be useful.

There is a file from Neo4J that comes with the Desktop and contains a data export from Northwind. This looks like this when you open it:

2022-08-02 16_24_48-employees.csv - Excel

On the page where Neo4j talks about the employee imports, they have this code:

// Create employees
LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/jexp/054bc6baf36604061bf407aa8cd08608/raw/8bdd36dfc88381995e6823ff3f419b5a0cb8ac4f/employees.csv' AS row
MERGE (e:Employee {employeeID:row.EmployeeID})
   ON CREATE SET e.firstName = row.FirstName, e.lastName = row.LastName, e.title = row.Title;

This loads fine.

When I run this code, it works. When change to this, it fails. It’s erroring out on my file. I tried moving the file, removing nulls, etc.

LOAD CSV WITH HEADERS FROM 'file:///employees.csv' AS row

MERGE (e:Employee {employeeID:row.EmployeeID})

ON CREATE SET e.firstName = row.FirstName, e.lastName = row.LastName, e.title = row.Title;

Here’s the error in the Neo4j Browser:

2022-08-02 16_35_03-neo4j@bolt___localhost_7687_neo4j - Neo4j Browser

I kept editing the file and trying different things. I compared what I had locally with what was on GitHub. Eventually, I realized this is the issue:

{employeeID:row.EmployeeID}

In the GitHub csv, the first row has headers with EmployeeID. In my local file, the header is “employeeID” (lower case). As soon as I edited this, it worked.

THIS IS THE FILE THAT CAME WITH NEO4J DESKTOP.

They make mistakes, just like I do. I hate that there are too many things like that that are care sensitive. I get that sometimes you want data to be in a particular format, but I think in the modern world, making metadata case sensitive isn’t productive.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

Share

Share

Rate