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.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , . Bookmark the permalink.

3 Responses to Working with Neo4j Imports–I HATE CASE SENSITIVITY

  1. Jeff Moden says:

    I’m right their with you on Case Sensitivity. I tell people that ask me about it to NOT make the whole bloody server case sensitive… just the columns that need it, which are far and few between. That does have some ramifications when it comes to TempDB but it’s well worth any brief time on such workarounds compared to having a full case sensitive server.

    That’s one of the reasons I hated Oracle. Apparently, it defaults to being case sensitive to “help performance”.

    Like

  2. way0utwest says:

    I wish we could have case-sensitive data WITHOUT any code needing to follow, including column names.

    Like

  3. Jeff Moden says:

    I definitely agree that meta data shouldn’t be case sensitive. I guess there are some languages that couldn’t do without it, though.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.