The problem
I'm trying to save a serialized object (using cPickle) into a Cassandra 1.2 column, I'm using the python cql library. I've already tried defining the column as text (utf8 string) and blob, in both cases I'm receiving the same error:
The object is a Python dict:
obj = {'id':'sometextid',
'time_created':05/12/2013, #<---- datetime
'some other string property': 'some other value'
}
The error is this:
raise cql.ProgrammingError("Bad Request: %s" % ire.why)
cql.apivalues.ProgrammingError: Bad Request: line 31:36 no viable alternative at character '\'
And looking at the executed CQL statement I can see some '\' characters after pickling the object, for instance:
Part of the pickled object
cdatetime
datetime
p4
(S'\x07\xdd\x03\x1c\x000\x13\x05\xd0<'
tRp5
My questions
What is the usual way of serializing a python dict (including datetimes) to save it into cassandra 1.2 using the cql library? Is there a better or more straightforward way of doing this?
Thanks in advance!