raw_columns=True causes infinite recursion when pickling #156

millarm opened this Issue Jun 27, 2012 · 0 comments


None yet
1 participant

millarm commented Jun 27, 2012

Get an object using a ColumnFamilyMap with raw_columns=True then try to pickle it - you get an infinite recursion.

This means an object that has been restored with raw_columns=True can't be saved to cache.

A trivial example to demonstrate the problem uses a keyspace "tellybug_dev" with a single CF "test_example"

Run below. One would reasonably expect it to print out "success!". It doesn't. :-)

keyspace "tellybug_dev", create column family test_example;

import pycassa
import pickle

pool = pycassa.ConnectionPool(keyspace="tellybug_dev",server_list=[""])

class CassandraObject(object):
key = pycassa.types.UTF8Type()
value = pycassa.types.UTF8Type()

obj = CassandraObject()
obj.key = "hello"
obj.value = "world"

cf_map = pycassa.ColumnFamilyMap(CassandraObject,pool,"test_example")



pickled_obj = pickle.dumps(read_obj)

obj2 = CassandraObject()
obj2.key = "hello2"
obj2.value = "world"

cf_map2 = pycassa.ColumnFamilyMap(CassandraObject,pool,"test_example",raw_columns=True)



pickled_obj = pickle.dumps(read_obj2)

print "success!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment