Cassandra Batch_insert example in C#.net
- by Sandeep
Can any one please give me an example on how to work on Cassandra batch_insert in C# thrift client?
If possible please let me know where am I going wrong in the following code.
Dictionary dictionary = new Dictionary();
Dictionary subColumns = new Dictionary();
List listOfMutations = new List();
listOfMutations.Add(new Mutation() { Column_or_supercolumn = new ColumnOrSuperColumn() { Column = new Column() { Name = utf8Encoding.GetBytes("AA"), Value = utf8Encoding.GetBytes("Answer Automation"), Timestamp = timeStamp } } });
listOfMutations.Add(new Mutation() { Column_or_supercolumn = new ColumnOrSuperColumn() { Column = new Column() { Name = utf8Encoding.GetBytes("CT"), Value = utf8Encoding.GetBytes("Call Tracker"), Timestamp = timeStamp } } });
listOfMutations.Add( new Mutation() { Column_or_supercolumn = new ColumnOrSuperColumn() { Column = new Column() { Name = utf8Encoding.GetBytes("TL"), Value = utf8Encoding.GetBytes("Track That Lead"), Timestamp = timeStamp } } });
SuperColumn superColumn = new SuperColumn()
{
Name=utf8Encoding.GetBytes("Indatus")
};
subColumns.Add("Super1", listOfMutations);
dictionary.Add("Indatus", subColumns);
client.batch_mutate("Keyspace1",dictionary, ConsistencyLevel.ONE);
I understand that SuperColumn struct expects List but I does not have a list of Columns. Rather I have List.
Thanks in Advance.