c++ - 在 Cassandra 中插入多列

标签 c++ nosql cassandra

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

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

最佳答案

Thrift 接口(interface)有一个 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)

关于c++ - 在 Cassandra 中插入多列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12170134/

相关文章:

mongodb - 如何使用 URI 导出数据库中的所有集合?

mysql - 在 Couchbase 中更新高度嵌套的文档

mongodb - 复合分片键如何读取数据

java - Jna链接错误: How to solve this error while starting cassandra

hadoop - 运行 Cassandra + Pig 时出错

c++ - if-else 树优化

c++ - 将 point2d 转换为 Mat

python - Celery Worker 不执行 cassandra 查询

c++ - 使用 Poco 和 Boost C++ 的多个 Http 服务器

c++ - 取消对用户输入 C++ 的调用