user2645822
user2645822

Reputation: 41

Using multiple column filters with HappyBase

I'm using HappyBase as Python Thrift client to connect to HBase.

I'm scanning the table and need to use filters on multiple columns. How this can be achieved in HappyBase? Java gives an option for this using Filterlist.

Upvotes: 3

Views: 5996

Answers (1)

SIkwan
SIkwan

Reputation: 379

As specified on the github page, Happybase is using Thrift. You should use the same syntax as thrift.

On your scan function, you can specify a filter string :

SingleColumnValueFilter(‘’, ‘, , ‘’)

For example, if you need to scan all rows with the column blah:blouh = batman :

hbase_table.scan(filter="SingleColumnValueFilter ('blah','blouh',=,'regexstring:^batman$')")

You can use AND or OR to put several filters, just remember to surround everything with parenthesis.

Thrift Documentation : http://hbase.apache.org/book/thrift.html

Be careful when creating filters on string, you will have to use a specific comparator (like regexstring in my example).

Upvotes: 11

Related Questions