Problem Statement : I am trying to import the CSV data (will provide sample of it) into Neo4J I am trying to follow the tutorial from YouTube (by Neo4J - https://www.youtube.com/watch?v=Eh_79goBRUk) on trying to get it work.
However, when I try to run the following query , it fails at Cannot merge node using null property value for customer_id (Failure when processing file '/Users/zuperduper/stuff.csv' on line 2.)
Dataset
There aren't any null in the fields , all of the fields are populated.
customer_id,review_id,product_id,product_category,review_date
33620853,R1QRX00VPUAA1G,B00A7W0VLY,Baby,2014-10-23
40919284,R1SZE4TH7QPXG6,B00NGV8RUU,Baby,2014-10-18
36567020,R2NST8F25WDOG2,B00LIRJ2NU,Baby,2014-10-15
Cypher Code
// CREATE UNIQUE CONSTRAINTS FOR THIS
CREATE CONSTRAINT ON (c:Review_id) ASSERT c.review_id IS UNIQUE;
CREATE CONSTRAINT ON (c:Product_category) ASSERT c.product_category IS UNIQUE;
CREATE CONSTRAINT ON (c:Customer_id) ASSERT c.customer_id IS UNIQUE;
CREATE CONSTRAINT ON (c:Product_id) ASSERT c.product_id IS UNIQUE;
// LOAD STUFF
//USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM
'file:///Users/zuperduper/stuff.csv' AS line
WITH line , SPLIT(line.review_date,'/') AS date
CREATE (review_id:Review_ID {id: toInteger(line.`review_id`)})
SET review_id.year = toInteger(date[0])
SET review_id.month = toInteger(date[1])
SET review_id.day = toInteger(date[2])
MERGE (customer_id:Customer_id {customer_id: toInteger(line.`customer_id`)})
MERGE (Product_category:Product_category {customer_id: toInteger(line.product_category)})
MERGE (product_id:Product_id {customer_id: toInteger(line.product_id)})
CREATE (customer_id)-[:WRITES]->(review_id)
CREATE (product_id)-[:CONTAINS]->(review_id)
CREATE (product_category)-[:PARTOF]->(product_id)
I am using Neo4j 4.1.0
I am not to sure if I should create the customer first and use the merge later. Just need some guidance on this