Column Families are keyed attribute/value pairs, your 'girls' column
will need to be serialised on save, and deserialiased on load so that
it can treated as your intended array. Pickle will do this for you
(http://docs.python.org/library/pickle.html)
eg:
import pycassa
import pickle
client = pycassa.connect()
cf = pycassa.ColumnFamily(client, 'mygame', 'user')
key = '1234567890'
value = {
'name': 'Lee Li',
'age'; '21',
'girls': pickle.dumps(['java', 'actionscript', 'python'])
}
cf.insert(key, value)
hope that helps
-michael
On Tue, Apr 6, 2010 at 6:49 PM, Shuge Lee <[email protected]> wrote:
> Dear firends:
>
> how to store list data in Apache Cassndra ?
>
> For example:
> user['lee'] = {
> 'name': 'lee',
> 'age'; '21',
> 'girls': ['java', 'actionscript', 'python'],
> }
> Notice key `gils`
>
> I using pycassa (a python lib of cassandra)
>
> import pycassa
> client = pycassa.connect()
> cf = pycassa.ColumnFamily(client, 'mygame', 'user')
>
> key = '1234567890'
> value = {
> 'name': 'Lee Li',
>
> 'age'; '21',
> 'girls': ['java', 'actionscript', 'python'],
> }
>
> cf.insert(key, value)
>
>
> Oops, get error while save a `value` like above.
>
> So, how to store list data in Apache Cassndra ?
>
>
> Thanks for reply.
>
>
>
>
> --
> Shuge Lee | Lee Li
>