使用 Python 中 HBase 的 HappyBase API,可以通过以下方式执行批量插入:
import happybase
connection = happybase.Connection()
table = connection.table('table-name')
batch = table.batch()
# put several rows to this batch via batch.put()
batch.send()
如果这批中途失败会发生什么?已经保存的行会保持保存而那些没有保存吗?
我在 HappyBase github 中注意到该table.batch()
方法采用transaction
和wal
作为参数。是否可以将这些配置为在批处理中途失败的情况下回滚成功保存的行?
happybase 会在这里抛出异常,这将允许我记下行键并执行批量删除吗?