Hello again,
I'm trying to use ETL to import from an RDBMS with a self referential
foreign key and can't work out the right syntax.
I either end up with duplicate documents or missing edges.
My last attempt was with the following config:
{
"extractor": {
"jdbc": {
"query": "SELECT * FROM task"
}
},
"transformers": [
// Rename field.
{"field": {"fieldName": "cid", "expression": "taskid"}}, // Aside:
Wanted to use "id", but seems is a reserved word?
{"field": {"fieldName": "taskid", "operation": "remove"}},
// Merge with existing.
{
"merge": {
"joinFieldName": "cid",
"lookup": "Context.cid"
}
},
// Transform to Vertex.
{"vertex": {"class": "Context"}},
// Create edge "parent" pointing to parent Context.
{
"edge": {
"class": "parent",
"joinFieldName": "parent_id",
"lookup": "Context.cid",
"unresolvedLinkAction": "CREATE",
"if": "parent_id is not null"
}
}
],
"loader": {
"orientdb": {
"dbType": "graph"
}
}
}
This resulted in duplicate Context records all with the same "cid" value,
whereas I was hoping for just one Context for each cid value (based on a
comment in another post).
If I remove
"unresolvedLinkAction": "CREATE",
then I end up with missing edges if the edge was attempted to be created
before the target vertex had been imported.
Any ideas on how to handle this case?
cheers,
Martin
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.