Storing an object in cassandra
Is it possible to store object and data structures within Cassandra column families?
For example:
object Person
{
string name;
string email;
Address address;
}
As you can see Person object has Address object within it.
Can I store it like this?
$ set Person['me']['name'] = 'foo'; 开发者_C百科
$ set Person['me']['email'] = 'foo@bar.com';
How about address? How to do it?
I'm using C# client.
Don't use super columns here; they aren't needed here and have other drawbacks, such as not allowing secondary indexes on columns.
You should either create one column for each field of the address (if you need to edit them at different times for some reason), or just serialize the address (to JSON, for example) and put it in one column. The cassandra-cli doesn't have tools for serializing and deserializing data as it's really just a utility or exploratory tool; you'll need to do this with a normal client.
精彩评论