fhe
fhe

Reputation: 57

Hbase Python Filter based on the row key

I'm using Python and Hbase and I need to filter rows from Hbase based on the row key.

I managed to make it work for a column title:t, but I couldn't find any way to apply the substring filter to the row key column.

Here is how I did it for title:t column and it works fine:

for key, data in index.scan(filter="SingleColumnValueFilter('title','t',=,'substring:Valera')"):

And here is how I'm doing for the row key:

for key, data in index.scan(filter="SingleColumnValueFilter('cf','id',=,'substring:Valera')"):

Do you have any suggestion on how to fix this issue?

Upvotes: 1

Views: 1211

Answers (1)

sel-fish
sel-fish

Reputation: 4476

Use RowFilter if you want to filter by row key :

for key, data in index.scan(filter="RowFilter(=,'substring:Valera')"):
    print key, data

Upvotes: 1

Related Questions