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.

Importing two CSV's

I have been trying not for 24hrs to get these CSV loaded with a relationship. However it keeps hanging on:

Neo.ClientError.Statement.SyntaxError: Invalid input 'S': expected 'n/N' (line 1, column 384 (offset: 383))

Initially when I wasn't using the " USING PERIODIC COMMIT" I was running into memory issues. After some research the USING PERIODIC COMMIT should solve the memory issue. which seems it did.

the import was written:
USING PERIODIC COMMIT LOAD CSV with headers from "file:///unit2.csv" as unitRow create (:rigs {UnitID: unitRow.Unit, Rigname: unitRow.Rigname, Region: unitRow.Region, Status: unitRow.Status, UnitType: unitRow.type, MaxInventoryValue: unitRow.MAX_ALLOWD_VAL, Client: unitRow.client, Regulations: unitRow.Local_Reg, Latitude: unitRow.latitude, Longitude: unitRow.longitude}); WITH * USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///masterinventory.csv" as ventRow create (riginventory:RigInventory {ItemID: ventRow.Item, LongDescription: ventRow.LongDescription, QtyOnHand: ventRow.QtyOnHand, UnitPrice: ventRow.UnitPrice, UsageQty: ventRow.UsageQty, Area: ventRow.Area, Lev1: ventRow.Lev1, Lev2: ventRow.Lev2, Lev3: ventRow.Lev3, Lev4: ventRow.Lev4, RigUnit: ventRow.Unit}) with riginventory Match (u:Rigs {UnitID : riginventory.RigUnit }) Create (u)-[:HOLDS_STOCK]->(riginventory)

I was hoping somebody can help in the right direction. Many thanks.

1 ACCEPTED SOLUTION

Most of Neo4J is case sensitive
For example

Label :Person is different than :person

View solution in original post

5 REPLIES 5

your inclusion of WITH * as the start of the 2nd statement is causing failure. I'm not sure what is trying to be accomplished with this WITH * but if it is removed then the statement will run and no longer produce a syntax error

Thanks that worked. However it didn't work in the default browser. I used the Canary browser and that worked ok. However there relationship wasn't created. Thanks for the feedback

I spoke too soon.It looked like it worked but it only loads the 118 nodes, but all are empty. I checked the CSV with a tool and came back ok. so I am doing something wrong. I am just focusing on the first statement.

USING PERIODIC COMMIT LOAD CSV with headers from "file:///unit2.csv" as unitRow create (:Rigs {UnitID: unitRow.Unit, Rigname: unitRow.Rigname, Region: unitRow.Region, Status: unitRow.Status, UnitType: unitRow.type, MaxInventoryValue: unitRow.MAX_ALLOWD_VAL, Client: unitRow.client, Regulations: unitRow.Local_Reg, Latitude: unitRow.latitude, Longitude: unitRow.longitude})

Also tried FIELDTERMINATOR. but made no difference.

Okay figured it out. Good learning curve , The statement with LOAD CSV is case sensitive, meaning if the column headers in the CSV are uppercase the Statement needs to be UPPERCASE too. All loaded perfectly.. now the fun part starts

Most of Neo4J is case sensitive
For example

Label :Person is different than :person