OrientDB ETL with self joined mysql table

时间:2015-06-26 09:45:18

标签: etl orientdb

I'm trying (new to OrientDb) to load my old fashioned self joined mysql table to OrientDb. I'm kinda stuck, I want to create vertices and edges with ETL but edges are created to empty vertices. I spent many hours in the documentation but can't find what I am missing.

Here is my oetl json file :

{
  "config": {
    "log": "debug"
  },
  "extractor" : {
    "jdbc": { "driver": "com.mysql.jdbc.Driver",
      "url": "***",
      "userName": "***",
      "userPassword": "***",
      "query": "select nid, pnid, label from prod_arbo limit 500" }
  },
  "transformers" : [
    { "vertex": { "class": "Noeud", "skipDuplicates": true} },
    { "field": { "fieldName": "titre", "expression": "label"}},
    { "field": { "fieldName": "titre", "operation": "remove"} },
    { "field": { "fieldName": "pnid", "operation": "remove"} },
    { "edge": {
      "class": "Parent",
      "joinFieldName": "pnid",
      "lookup": "Noeud.nid",
      "unresolvedLinkAction": "CREATE"
    } }
  ],
  "loader" : {
    "orientdb": {
      "dbURL": "***",
      "dbUser": "***",
      "dbPassword": "***",
      "standardElementConstraints": false,
      "tx": false,
      "wal": false,
      "dbType": "graph"
    }
  }
}

Mysql db is like :

nid -> autoincrement unique id
label -> need to put this in field "titre"
pnid -> parent self join

I get logs like this :

[43:edge] DEBUG Transformer input: v(Noeud)[#13:57377]
[43:edge] DEBUG joinCurrentValue=null, lookupResult=null
[43:edge] DEBUG created new vertex=Noeud#13:57378{nid:null} v36
[43:edge] DEBUG created new edge=e[#17:56380][#13:57377-Parent->#13:57378]
[43:edge] DEBUG Transformer output: v(Noeud)[#13:57377]

And I don't understand why nid is null on new created vertex while created edge, how can I do to make it use pnid field here ?

Many thanks for your help Laurent

0 个答案:

没有答案