在Cassandra中插入多列

Inserting multiple columns in Cassandra

本文关键字:插入 Cassandra      更新时间:2023-10-16

如何在C++中使用一个insert()为一行插入多个列?我使用的是节俭生成的cpp代码。

我注意到Java实现似乎有一个batch_insert(),它不存在于cpp生成的代码中。这是否意味着我必须为每一列调用insert(),或者有更好的方法吗?

Thrift接口有一个batch_mutate()调用,允许您传入突变映射——突变是任何插入或删除。

来自Thrift规范:

/**
Mutate many columns or super columns for many row keys. See also: Mutation.
mutation_map maps key to column family to a list of Mutation objects to take place at that scope.
  **/
void batch_mutate(1:required map<binary, map<string, list<Mutation>>> mutation_map,
                  2:required ConsistencyLevel consistency_level=ConsistencyLevel.ONE)
     throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te)