使用ETL从PostgresQL导入到OrientDB时处理UUID

时间:2016-06-01 16:17:25

标签: postgresql etl orientdb

我在PostgresQL中有一个带有2个表的图表:

  • vertex(id:uuid)
  • edge(from:uuid,to:uuid)

我使用etl将它转换为orientdb for vertex:

{
  "config": {
    "log": "debug"
  },
  "extractor" : {
    "jdbc": { "driver": "org.postgresql.Driver",
              "url": "jdbc:postgresql://localhost/test",
              "userName": "postgres",
              "userPassword": "123456",
              "query": "select id from vertex" }
  },
  "transformers" : [
   { "vertex": { "class": "vertex"} }
  ],
  "loader" : {
    "orientdb": {
      "dbURL": "PLOCAL:../databases/test",
      "dbUser": "admin",
      "dbPassword": "admin",
      "dbAutoCreate": true,
      "dbAutoDropIfExists": false
    }
  }
}

在OrientDB中浏览结果时,我在id字段中看到的值似乎与我在PorgresQL中查询时得到的结果不一致。

然后我运行etl for edge:

{
  "config": {
    "parallel" : true,
    "log": "debug"
  },
  "extractor" : {
    "jdbc": { "driver": "org.postgresql.Driver",
              "url": "jdbc:postgresql://localhost/test",
              "userName": "postgres",
              "userPassword": "123456",
              "query": "select from, to from edge" 
        }
  },
  "transformers": [ 
    { "merge": { "joinFieldName": "from", "lookup": "vertex.id" } }, 
    { "vertex": {"class": "vertex", "skipDuplicates": true} }, 
    { "edge": { "class": "has_edge", "joinFieldName": "to", "lookup": "Vertex.id", "direction": "in" } }, 
    { "field": { "fieldNames": ["from", "to"], "operation": "remove" } } 
  ],
  "loader" : {
    "orientdb": {
      "dbURL": "PLOCAL:../databases/test",
      "dbUser": "admin",
      "dbPassword": "admin",
      "dbAutoCreate": true,
      "dbAutoDropIfExists": false
    } 
  }
}

调试打印出来的控制台有一些边缘,etl处理器无法查找fromto的引用。这种消息使用PostgresQL中的uuids。由于它们与我在OrientDB中可以查询的值不一致,因此很难找出导致问题的边缘。

我的问题是:如何配置我的etl以使uuid从PostgresQL导入到OrientDB?

0 个答案:

没有答案