基于行键的Hbase Python过滤器 [英] Hbase Python Filter based on the row key

查看:298
本文介绍了基于行键的Hbase Python过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python和Hbase,我需要根据行键从Hbase过滤行.

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

我设法使其适用于列title:t,但找不到任何方法将子字符串过滤器应用于行键列.

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.

这是我为title:t列所做的,并且工作正常:

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?

推荐答案

如果要按行键进行过滤,请使用RowFilter :

Use RowFilter if you want to filter by row key :

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

这篇关于基于行键的Hbase Python过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆