"reversed" is a boolean option on the SliceRange that you pass in the get_slice method via its predicate parameter.
Michael On Sun, Oct 25, 2009 at 8:26 PM, kevin <[email protected]> wrote: > hi jonathan > thanks for the clarification. > >>>>subcolumns is what you want (with the reverse option to slice, to get >>>> most-recent-first). > > is reverse an option in get_slice method or in my python code or in the > config file? > > > > On Sun, Oct 25, 2009 at 5:40 PM, Jonathan Ellis <[email protected]> wrote: >> >> Sorry, the paragraph about subcolumns always being sorted by time is >> outdated. (I've taken it out on the 0.4 branch now -- it was already >> gone in trunk.) Read just below that about how comparewith and >> comparesubcolumnswith work. Sounds like using TimeUUIDType for >> subcolumns is what you want (with the reverse option to slice, to get >> most-recent-first). >> >> On Sun, Oct 25, 2009 at 5:17 PM, kevin <[email protected]> wrote: >> > 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')]))] >> > > >
