incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bayle Shanks <bsha...@pietrust.com>
Subject composite types in CQL
Date Thu, 01 Mar 2012 21:39:53 GMT
hi, i'm wondering how to do composite data
storage types in CQL. I am trying to mimic the Composite Types
functionality of the Pycassa client:

http://pycassa.github.com/pycassa/assorted/composite_types.html


In short, in Pycassa you can do something like:

---

itemTimeCompositeType = CompositeType(UTF8Type(), LongType())

pycassa.system_manager.SystemManager().create_column_family(
  keyspaceName,
  columnFamilyName, 
  key_validation_class=itemTimeCompositeType
)

...

columnFamily.insert(self._makeKey(item, time_as_integer), {field : value})

---


and then your primary key for this column family is a pair of a string
and an integer. This is important because i am using
ByteOrderedPartitioner and doing range scans among keys which share
the same string 'item' but have different values for the integer.

My motivation is that i am trying to port
https://github.com/bshanks/cassandra-timeseries-py to Ruby and i
thought i might try CQL.

thanks,
  bayle

Mime
View raw message