1

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

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

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

4

1 回答 1

0

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

最后,我在这里找到了一个旧版本: 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')]

希望有帮助

于 2013-10-23T17:19:00.290 回答