tags:

views:

534

answers:

2

Please Provide an example on how to work with batch_mutate() in C#.net?

Thanks in advance.

+2  A: 
Dictionary <string, Dictionary<string, List<Mutation>>> dictionary = new Dictionary<string, Dictionary<string, List<Mutation>>>();

List<Mutation> columnsToadd = new List<Mutation>();
List<Column> customers = new List<Column>();

//List of SuperColumns

customers.Add(new Column() { Name = utf8Encoding.GetBytes("street"), Timestamp = timeStamp, Value = utf8Encoding.GetBytes("Test") });

customers.Add(new Column() { Name = utf8Encoding.GetBytes("Zip"), Timestamp = timeStamp, Value = utf8Encoding.GetBytes("Test") });

customers.Add(new Column() { Name = utf8Encoding.GetBytes("city"), Timestamp = timeStamp, Value = utf8Encoding.GetBytes("Test Hills") });

Dictionary<string, List<Mutation>> innerMap = new Dictionary<string, List<Mutation>>();
Mutation columns = new Mutation()
{
 Column_or_supercolumn = new ColumnOrSuperColumn() { Super_column = new SuperColumn() { Name = utf8Encoding.GetBytes("John1"), Columns = customers } }
};

columnsToadd.Add(columns);
ColumnPath nameColumnPath = new ColumnPath()
 {
       Column_family = "Super1",
       Super_column = utf8Encoding.GetBytes("John1"),
       Column = utf8Encoding.GetBytes("customers")
 };
 innerMap.Add("Super1", columnsToadd);
 dictionary.Add("Phatduckk", innerMap);
 client.batch_mutate("Keyspace1", dictionary, ConsistencyLevel.ONE);
Sandeep
A: 

how to get this value,i am a little confused,when i do this:

get Keyspace1.Super1['Phatduckk']

and it just returned 0 columns;

and is there something wrong?

medcl
get Keyspace1.Super['John1'] //This is the SuperColumn Name. If you like to get Pathduckk, use get Keyspace1.Super['John1']['pathduckk']
Sandeep