incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevin <kevincastigli...@gmail.com>
Subject are columns of a supercolumn name sorted?
Date Sun, 25 Oct 2009 23:17:25 GMT
i am inserting three columns x,a,z into a super column named 'sc_2'. the
config file says that the columns of a super column are timesorted, but when
i get_slice it is sorted by the name of the columns. how do i get it time
sorted so that i get the most recently inserted/updated column first?
cassandra version apache-cassandra-incubating-0.4.1-bin.tar.gz, and lazyboy
latest git clone.
thanks


>>> import lazyboy,time, pprint
>>> from cassandra import Cassandra
>>> from cassandra.ttypes import *


>>> client=lazyboy.connection.Client(['localhost:9160'])
>>> keyspace = "Keyspace1"
>>> key='mykeyx'
>>> column_path =
ColumnPath(column_family="Super1",column="x",super_column='sc_2')
>>> client.insert(keyspace, key, column_path, 'a', time.time(),
ConsistencyLevel.ONE);
>>> column_path =
ColumnPath(column_family="Super1",column="a",super_column='sc_2')
>>> client.insert(keyspace, key, column_path, 'a', time.time(),
ConsistencyLevel.ONE);
>>> column_path =
ColumnPath(column_family="Super1",column="z",super_column='sc_2')
>>> client.insert(keyspace, key, column_path, 'a', time.time(),
ConsistencyLevel.ONE);


>>> slice_range = SliceRange(start="", finish="")
>>> predicate = SlicePredicate(slice_range=slice_range)
>>> column_parent = ColumnParent(column_family="Super1")
>>> client.get_slice(keyspace, key, column_parent, predicate,
ConsistencyLevel.ONE)
[ColumnOrSuperColumn(column=None, super_column=SuperColumn(name='sc_2',
columns=[Column(timestamp=1256512261, name='a', value='a'),
Column(timestamp=1256512252, name='x', value='a'),
Column(timestamp=1256512267, name='z', value='a')]))]

Mime
View raw message