cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: are columns of a supercolumn name sorted?
Date Mon, 26 Oct 2009 03:00:16 GMT
it's the "column" attribute of the column_path parameter.

uuids have a specific meaning:
http://en.wikipedia.org/wiki/Universally_Unique_Identifier

test/system/test_server.py has an example of passing time uuids in python.

On Sun, Oct 25, 2009 at 8:52 PM, kevin <kevincastiglione@gmail.com> wrote:
> i tried the TimeUUIDType and I get the error. can you tell me which here
> should be a UUID? what is time based uuid? and which parameter here should
> be uuid?
> 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);
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Users/kevin/common/lazyboy/connection.py", line 109, in func
>     raise e
> cassandra.ttypes.InvalidRequestException: InvalidRequestException(why='UUIDs
> must be exactly 16 bytes')
>
> this is the config in storage-conf.xml
>
>       <ColumnFamily CompareWith="BytesType"
>                     Name="Standard1"
>                     FlushPeriodInMinutes="60"/>
>       <ColumnFamily CompareWith="UTF8Type" Name="Standard2"/>
>       <ColumnFamily CompareWith="TimeUUIDType" Name="StandardByUUID1"/>
>       <ColumnFamily ColumnType="Super"
>                     CompareWith="UTF8Type"
>                     CompareSubcolumnsWith="TimeUUIDType"
>                     Name="Super1"/>
>
>
> On Sun, Oct 25, 2009 at 5:40 PM, Jonathan Ellis <jbellis@gmail.com> 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 <kevincastiglione@gmail.com> 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')]))]
>> >
>
>

Mime
View raw message