Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

raw_columns=True causes infinite recursion when pickling #156

Open
millarm opened this Issue · 0 comments

1 participant

@millarm

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=["127.0.0.1"])

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")

cf_map.insert(obj)

read_obj=cf_map.get(key="hello")

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)

cf_map2.insert(obj2)

read_obj2=cf_map2.get(key="hello2")

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
Something went wrong with that request. Please try again.