3
votes

I'm using neo4j 2.1.2 for windows I was attempting to use Neo4j's load csv command but I get the following error...

neo4j-sh (?)$ load csv with headers "file:../test/unclaimed.csv" AS csvLine
 MERGE (o:Original_Transaction_Number { value: csvLine.OTN })
 MERGE (i:Institution {name: csvLine.Institution })
 MERGE (i)<-[:TRANSACTION_OF]-(o)
 ;


SyntaxException: Invalid input 'l': expected <init> (line 1, column 1)
"load csv with headers "file:../test/unclaimed.csv" AS csvLine"
 ^

infact I get the same error by just entering load

neo4j-sh (?)$ load ;
==> SyntaxException: Invalid input 'l': expected <init> (line 1, column 1)
==> "load "
==>  ^

Could anyone explain what's happening?

(EDIT:)->(FIXED)->(THE PROBLEM)

Combination of issues here.

  1. I had earlier tried upgrading to 2.1.2 be simply extracting files to 2.0.3 folder - fixed - thanks @Stefan

  2. Fixing 1. and prefixing with "cypher 2.1" (thanks @Michael) gave more informative error "SyntaxException: Invalid input '"': expected whitespace, comment or FROM (line 1, column 23) - I was missing the FROM keyword

  3. After getting many "LoadExternalResourceException: Couldn't load the external resource at: file:../test/unclaimed.csv" and many variants of "file://c:/nosql/test/" etc i finally figured that the syntax for accessing a local file on windows is simply "file:c:/nosql/test/unclaimed.csv" and not file:// as might be inferred from examples on http://neo4j.com/docs/2.1.2/cypherdoc-importing-csv-files-with-cypher/ or anyone familiar with URI schema

Thanks folks

that is not expected. Are you sure you're running Neo4j 2.1.2? Check using neo4j-sh (?)$ dbinfo -g Kernel KernelVersion.Stefan Armbruster
can you try to prefix it with cypher 2.1 load ...Michael Hunger
Huge thanks for the note about the Windows file path format! I kept adding the file:// over and over until I saw this post.JasonBub