简体   繁体   中英

Inserting multiple columns in Cassandra

How can I insert multiple Columns for one row using one insert() in C++? I'm using the thrift generated cpp code.

I noticed the Java implementation seems to have a batch_insert(), which doesn't exist in the cpp generated code. Does that mean I have to call insert() for each column or is there a better way?

The Thrift interface has a batch_mutate() call that allows you to pass in a map of mutations--a mutation being any insert or delete.

From the Thrift spec:

/**
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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM