0

是否可以创建触发器以将表记录从 rethinkdb/memsql 导出到 postgresql 表,或者后者可能是一个适当的解决方案?

这样做的目的是在元组完全填充到另一个数据库后尽可能快速和可靠地传输它们。

4

1 回答 1

0

我认为您可以使用 changefeeds,侦听插入/更新的新记录并将其刷新到 postgresql。

假设您可以在 NodeJS 中执行此操作:

var r = require('rethinkdb')

r.connect()
  .then(function(conn) {
    return r.table('user')
      .changes()('new_val')
      .run(conn)
  })
  .then(function(cursor) {
    cursor.each(function(err, doc) {
      //do somethng with this document, such as writing it to a table in postgresql
      console.log(doc)
    })
  })
于 2015-11-06T19:08:46.180 回答