Skip to content

Instantly share code, notes, and snippets.

@devdazed
Created February 7, 2013 19:12
Show Gist options
  • Select an option

  • Save devdazed/4733326 to your computer and use it in GitHub Desktop.

Select an option

Save devdazed/4733326 to your computer and use it in GitHub Desktop.
import json
from pycassa.pool import ConnectionPool
from pycassa.columnfamily import ColumnFamily
from pycassa.cassandra.ttypes import ConsistencyLevel, NotFoundException
HOSTS = ['localhost']
pool = ConnectionPool('my_keyspace', HOSTS)
my_cf = ColumnFamily(pool, 'my_cf')
for row in my_cf.get_range():
output = { 'KEY': row[0] }
for column, value in row[1].iteritems():
output[column] = value
print json.dumps(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment