cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Hobbs <ty...@datastax.com>
Subject Re: HOW TO select a column or all columns that start with X
Date Wed, 03 Aug 2011 01:50:33 GMT
A minor correction:

To get all columns starting with "ABC_", you would set column_start="ABC_"
and column_finish="ABC`" (the '`' character comes after '_'), and ignore the
last column in your results if it happened to be "ABC`".

column_finish, or the "slice end" in other clients, is inclusive.  You could
of course use "ABC_~" as column_finish and avoid the check if you know that
you don't have column names like "ABC_~FOO" that you want to include.

On Tue, Aug 2, 2011 at 7:17 PM, aaron morton <aaron@thelastpickle.com>wrote:

> Yup, thats a pretty common pattern. How exactly depends on the client you
> are using.
>
> Say you were using pycassam, you would do a get()
> http://pycassa.github.com/pycassa/api/pycassa/columnfamily.html#pycassa.columnfamily.ColumnFamily.get
>
> with column_start="ABC_" , count to whatever, and column_finish not
> provided.
>
> You can also provide a finish and use the highest encoded character, e.g.
> ascii 126 is ~ so if you used column_finish = "ABC_~" you would get
> everything that starts with ABC_
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 3 Aug 2011, at 09:28, Eldad Yamin wrote:
>
> Hello,
> I wonder if I can select a column or all columns that start with X.
> E.g I have columns ABC_1, ABC_2, ZZZ_1 and I want to select all columns
> that start with ABC_ - is that possible?
>
>
>
> Thanks!
>
>
>


-- 
Tyler Hobbs
Software Engineer, DataStax <http://datastax.com/>
Maintainer of the pycassa <http://github.com/pycassa/pycassa> Cassandra
Python client library

Mime
View raw message