在Hbase的ScannerOpen的第5个参数中要指定的属性是什么?

时间:2013-10-10 09:27:33

标签: python hbase thrift

我已经安装了HBase并使用链接http://whynosql.com/using-thrift-python-client-with-hbase/配置了thrift服务器。我不知道当我调用ScannerOpen时要指定的属性,其原型在Hbase.py中如下

def scannerOpen(self, tableName, startRow, columns, attributes):

任何人都可以让我知道我可以指定什么属性以及它们各自的含义?

1 个答案:

答案 0 :(得分:0)

你和我两个,萌...你喜欢我可能正在使用最新的Hbase.thrift定义文件,它有4个(如果包含'self'则为5个),但所有文档都谈到3个 - “属性“参数已经潜入,如果有人知道如何使用它,他们不是说......

最后,我在这里发现了一个旧版本: https://github.com/wbolster/happybase/blob/master/happybase/Hbase.thrift

这是我使用它的方式,取自HBase In Action示例:

>>> import thrift
>>> import hbase
>>> from thrift.transport import TSocket
>>> from thrift.protocol import TBinaryProtocol
>>> from hbase import Hbase
>>> transport =TSocket.TSocket("yeps85228", 9090)
>>> protocol = TBinaryProtocol.TBinaryProtocol(transport)
>>> client = Hbase.Client(protocol)
>>> transport.open()
>>> client.getTableNames()
['followedBy', 'follows', 'twits', 'users']
>>> columns = ['info:user', 'info:name','info:email']
>>> scanner = client.scannerOpen('users','',columns)
>>> scanner
1
>>> row = client.scannerGet(scanner)
>>> row
[TRowResult(columns={'info:email': TCell(timestamp=1382538013868L, value=' Andre
w19@pangane.com'), 'info:name': TCell(timestamp=1382538013868L, value='Casey And
rew'), 'info:user': TCell(timestamp=1382538013868L, value=' Andrew19')}, row=' A
ndrew19')]

希望有所帮助