On Mon, May 10, 2010 at 11:36 PM, vd <vineetdan...@gmail.com> wrote:

> Hi Mike
>
> AFAIK cassandra queries only on keys and not on column names, please
> verify.
>

Incorrect. You can slice a row or rows (identified by a key) on a column
name range (e.g., "a" through "m") or ask for specific columns in a row or
rows (e.g., please give me the "first_name," "last_name" and
"hashed_password" fields from my Users column family where the key equals
"mmalone").

See the get_range_slices() method in the thrift service.

Mike


>
>
>
> On Tue, May 11, 2010 at 11:06 AM, Mike Malone <m...@simplegeo.com> wrote:
> >
> >
> > On Mon, May 10, 2010 at 9:00 PM, Shuge Lee <shuge....@gmail.com> wrote:
> >>
> >> Hi all:
> >> How to write WHERE ... LIKE query ?
> >> For examples(described in Python):
> >> Schema:
> >> # columnfamily name
> >> resources = [
> >>    # key
> >>     'foo': {
> >>         # columns and value
> >>         'url': 'foo.com',
> >>         'pushlier': 'foo',
> >>     },
> >>     'oof': {
> >>         'url': 'oof.com',
> >>         'pushlier': 'off',
> >>     },
> >>    #  ... ,
> >> }
> >> # this is very easy,
> >> SELECT * FROM KEY = 'foo'
> >> but following are really hard:
> >> SELECT * FROM resources WHERE key LIKE 'o%' # get all records which key
> >> name contains character 'o'?
> >
> > get_range_slices(<keyspace>, ColumnParent(column_family),
> > SlicePredicate(slice_range=SliceRange('',''), KeyRange('o', 'o~'),
> > ConsistencyLevel.ONE);
> >
> >>
> >> SELECT * FROM resources WHERE url == 'oof.com'
> >
> > This is a projection. Cassandra doesn't support this sort of query out of
> > the box. You'll have to structure your data so that data you want to
> query
> > by is in the key or column name. Or you'll have to manually build
> secondary
> > indexes.
> >
> > Mike
> >
>

Reply via email to