pycassa example in cassandra 0.7.0

간단한 pycassa 를 이용한 Cassandra Connect example

#!/usr/bin/env python
import pycassa
client = pycassa.connect_thread_local('MyKeySpace', ['172.27.0.3:9160','172.27.0.4:9160'])
cf = pycassa.ColumnFamily( client, 'User' )
value = list(cf.get_range())
value_len = len(value)
print value_len
print value[0][0]
print value[0][1]
print value[0][1].keys()

result:

./test.py

1

charsyam

OrderedDict([(‘age’, ’32’), (’email’, ‘charsyam@naver.com’), (‘name’, ‘DaeMyung Kang’)])

[‘age’, ’email’, ‘name’]