You can't specify that sort of custom type as part of the schema; instead,
use BytesType and tell pycassa to interpret those columns as your custom
type through the 'column_validators' attribute on your ColumnFamily object.

For example:

mycf = ColumnFamily(...)
mycf.column_validators["email_addresses"] = MyListType()

Basically, pycassa will call your pack() function when inserting that
column and your unpack() function when reading that column.


On Sat, Aug 10, 2013 at 9:20 AM, Vladimir Prudnikov
<v.prudni...@gmail.com>wrote:

> Hi all,
> I use pycassa and I want to store lists and tuples in cassandra by
> serializing them using MessagePack. Seems like custom data type is what I
> need. Here is data type I created:
> ##########################################
> class MyListType(CassandraType):
>     @staticmethod
>     def pack(value):
>         return msgpack.packb(value)
>
>     @staticmethod
>     def unpack(value):
>         return msgpack.unpackb(value)
> ##########################################
> Now I'm creating a new column family and use instance of this class in
> column_validation_classes but unsuccessful. It raises
> "InvalidRequestException: InvalidRequestException(why="Unable to find
> abstract-type class 'org.apache.cassandra.db.marshal.MyListType'")".
>
> What I'm doing wrong? How to do it properly?
> Thanks.
> --
> Vladimir Prudnikov
>



-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Reply via email to