OrientDB ETL转换以创建边

时间:2016-01-26 21:47:18

标签: orientdb

我正在尝试使用带有ETL转换的JDBC直接从Oracle提取数据到OrientDB。我有2个表警报,其他是由键列(alert_id)连接的userRead表。我没有成功通过顶点创建边缘,使用源数据成功创建索引。



//alert:
{
  "config": {
    //  "log": "debug",
    "parallel": true
  },
  "extractor" : {
    "jdbc": { "driver": "oracle.jdbc.driver.OracleDriver",
              "url": "jdbc:oracle:thin:@hostname:port/dbname",
              "userName": "schema1",
              "userPassword": "password",
              "query": "select * from MC_ALERT$" }
  },
  "transformers" : [
   { "vertex": { "class":"MC_ALERT"} }
  ],
"loader": {
    "orientdb": {
      "dbURL": "plocal:/Users/dbadmin/workspace/orientdbEnprise2.1.8/databases/messaging",         
      "dbType": "graph",
      "dbUser": "admin",
      "dbPassword": "admin",
      "dbAutoCreate": true,
      "batchCommit": 1000,    
      "indexes": [
        {
          "class": "MC_ALERT",
          "fields": [ "alert_uuid:string" ],    
          "type": "UNIQUE"
        }
      ]
    }
  }
}



//userRead:

{
  "config": {
    "parallel": true
  },
  "extractor" : {
   "jdbc": { "driver": "oracle.jdbc.driver.OracleDriver",
              "url": "jdbc:oracle:thin:@hostname:port/dbname",
              "userName": "schema1",
              "userPassword": "password",
              "query": "select a.* from MC_ALERT_USER_READ$ a, MC_ALERT$ b where a.alert_id = b.alert_uuid" }
  },
  "transformers" : [
   { "vertex": { "class":"MC_ALERT_USER_READ"} },
   { "edge": { "class": "HAS_ALERT_READ",
                "joinFieldName": "ALERT_ID",
                "lookup": "MC_ALERT.ALERT_UUID",
                "direction": "in"
            }
    }          
  ],
"loader": {
    "orientdb": {
      "dbURL": "plocal:/Users/dbadmin/workspace/orientdbEnprise2.1.8/databases/messaging", 
      "dbType": "graph",
      "dbUser": "admin",
      "dbPassword": "admin",
      "dbAutoCreate": true,
      "batchCommit": 1000,    
      "classes": [
        {"name": "MC_ALERT","extends": "V"},
        {"name": "MC_ALERT_USER_READ", "extends": "V"},
        {"name": "HAS_ALERT_READ", "extends": "E"}
      ],
      "indexes": [
        {
          "class": "MC_ALERT_USER_READ",
          "fields": [ "client_oid:string","user_oid:string","alert_id:string"],      
          //"fields": [ "alert_id:string"],    
          "type": "UNIQUE"
        }
      ]
    }
  }
}




我需要创建边缘以通过alert_id在alert和userRead之间建立关系。

2 个答案:

答案 0 :(得分:0)

注意大写和小写的字段名称。

我尝试了一个例子并且有效。

enter image description here

让我知道。

答案 1 :(得分:0)

尽管内存不是问题,但OrientDB却出现了错误。重新启动orientDB后,它解决了JDBC问题。但是我不相信数据库重启。日志没有提供太多信息。