Reputation: 21
I have 3 CSV files to load in an OrientDB graph.
People.csv is like
person_id;name
1;francesco
2;luca
Product.csv is like
product_id;product_name
101;apple
102;banana
Purchases.csv is like
person_id;product_id;avg_price
1;101;$1.10
2;101;$1.08
1;102;$5.34
I load first all the people and the products with 2 different ETL jobs. Each job loads vertices.
How can I load periodically just the edges using OrientdbETL, as people buy new products?
All the Transformers and particularly EDGE output OrientVertex, that can only be INSERTed by the LOADER step. (The EDGE Transformer adds EDGE properties to the Vertex, but the actual action is an INSERT of the Vertex). Is there a way to update a Vertex using the ETL?
Rgds,
Francesco
Upvotes: 2
Views: 432
Reputation: 128
An ETL json with these transformers should import the "Purchase" edges from purchases.csv and update the avg_price of each purchased product.
"transformers": [
{ "merge": { "joinFieldName": "product_id", "lookup": "Product.id" } },
{ "vertex": {"class": "Product", "skipDuplicates": true} },
{ "edge": { "class": "Purchase",
"joinFieldName": "person_id",
"lookup": "Person.id",
"direction": "in"
}
},
{ "field": { "fieldNames": ["person_id", "product_id"], "operation": "remove" } }
]
class and attribute names ("Product.id", "Person", etc) may be different based on your DB schema.
Upvotes: 1