0
votes

I am trying to add new record that is a whole row into a labelled node in neo4j graph db. Lets say I have node named Customer

╒══════════════════════════════════════════════════════════════════════╕
│"n"                                                                   │
╞══════════════════════════════════════════════════════════════════════╡
│{"DISTRICT":"abc","THANA":"xyzzy","DIVISIO│
│N":"abc","REGDATE":"1-2-2015","ID":"0123"}          │
├──────────────────────────────────────────────────────────────────────┤

I want to add another row consists with these fields and relevant value from reading a csv file. This nodes holds a large data. so I think apoc with periodic iteration will be good idea for processing it parallel. but I am confused about adding a whole row into a labelled node. I have learnt to update property information through "merge on set on create" approach but can't perform to add new record into labelled node. I am expecting to see a table consisted new record having labelled node (customer). kindly help me to solve this

1
Please include the work you have done so far and the issues you are facing.Rajendra Kadam
Parallel processing with MERGE and apoc periodic iteration doesn't work. It throws NULL POINTER Exception. and if you set parallel processing false, then it will perform similar to LOAD CSV. Use periodic iteration and parallel processing only if you are using CREATE.Rajendra Kadam
The wording of the question is confusing. I don't think you really want to add multiple "rows" into a single labelled node. I believe you want to create multiple nodes that have the same label (presumably Customer). Is that correct? If so, take a look at LOAD CSV.cybersam
@cybersam I am wanting to add multiple rows in single label customer . lets say, my customer node has 10 rows with specific columns. I want to add more 5 rows in a way such that my updated customer node contains 15 rows. basically its a row updating in single label. any approach will be appreciable .if there is no way then it is also appreciable :) thanks for your messageKalyan
oh now I have got your idea. you are right I am wanting to create multiple node that have same label :) sorry for poor understanding . I have just checked it right now.In that case creating node from load csv will be ok .Kalyan

1 Answers

0
votes

Here is an example of how to use LOAD CSV to create your neo4j data from a CSV file. Please pay attention to the Introduction section of the docs for important info on how to configure the neo4j server and for where to store the CSV file (if you want to use a local file).

Suppose your data is in a input.csv file that starts with a header row, like this:

DISTRICT,THANA,DIVISION,REGDATE,ID
abc,xyzzy,abc,1-2-2015,0123
def,foobar,nbc,1-3-2015,0124

This query should then create one Customer node per file row:

LOAD CSV WITH HEADERS FROM 'file:///input.csv' AS row
CREATE (c:Customer)
SET c = row