Cassandra Batch_insert example in C#.net

Posted by Sandeep on Stack Overflow See other posts from Stack Overflow or by Sandeep
Published on 2010-05-06T17:13:43Z Indexed on 2010/05/06 17:18 UTC
Read the original article Hit count: 263

Filed under:

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.

© Stack Overflow or respective owner

Related posts about cassandra