2

I am trying to upload a simple csv into an Orient DB instance. My requirement is to update the existing vertex if the "Name" attribute is already present, else create a new record.

Even though the ETL executes without any exception, the IsDown attribute in the vertex isn't updated to the new value.

If I remove "skipDuplicates" : true, then there is an exception while trying to insert a duplicate value. - Duplicate key found

I am using Unique_has_index on CustomerService.Name

Please suggest how can I update attribute values for Vertex using OrientDB ETL

The csv is of the below mentioned format:

Name,IsDown
ABC,0
XYZ,0
ABC,0
DEF,0
FGH,0

And the json file is as below:

{  
config: {  log: "debug" },
"source" : { "file" : {"path": "C:\Users\innchoudh\Desktop\orientdb\customer.csv"}  },
"extractor" : {"csv": {} },
"transformers": [
 { "merge": { "joinFieldName":"Name", "lookup":"CustomerService.Name" } },
 { "vertex": { "class":"CustomerService", "skipDuplicates": true} }  ],
"loader" : {
"orientdb": {
  "dbURL": "remote:localhost/Smarts",
  "dbUser" : "admin",
  "dbPassword" : "admin",
  "dbType": "graph",
  "tx" : true,
  "batchCommit" : 1000
  }
 }
}   

I even tried to execute the script in a different way, but this is throwing exceptions:

{  
 config: {  "log": "debug" },
"source" : { "file" : {"path": "C:\Users\innchoudh\Desktop\orientdb\customer.csv"}  },
"extractor" : {"row": {} },
"transformers": [
  {"csv" : {"separator" : "," , "skipFrom" :1, "skipTo" :1 }}
  { "log": {} }
 "command" : { "command" : "UPDATE CustomerService set   CustomerService.IsDown = $input.IsDown UPSERT where CustomerService.Name = $input.Name"} 
],
"loader" : {
  "orientdb": {
    "dbURL": "remote:localhost/Smarts",
    "dbUser" : "admin",
    "dbPassword" : "admin",
    "dbType": "graph",
    "tx" : true,
    "batchCommit" : 1000
  }
}
}
  • @Lvca can you please help me here – Nandna Chowdhury Nov 17 '15 at 12:09
  • How do you know it's not updated if the value of IsDown of 'ABC' is always 0? The script seems correct. – Lvca Nov 17 '15 at 13:54
  • While executing the script I kept modifying values but DB wasn't updated. Is it correct that OrientDB supports updating existing vertex in the Db with new field values ? For eg. -On the 1st execution the values were: Name,IsDown ABC,0 XYZ,0 -On the 2nd execution: Name,IsDown ABC,1 XYZ,1 But the DB kept reflecting the values as per the 1st script. – Nandna Chowdhury Nov 19 '15 at 05:46
  • Just to add I am trying to update field values for vertex already existing in the database on re-execution of the json script. Is this supported? – Nandna Chowdhury Nov 19 '15 at 05:50

0 Answers0