扫描HBase时如何显示时间戳?

发布于 2025-01-18 13:16:02 字数 324 浏览 2 评论 0原文

for key, data in table.scan():
print('Found: {}, {}'.format(key, data))

我有一个HBASE表,需要扫描并打印时间戳。我已经编写了上述代码,但它仅产生像...

找到:b'row1',{b'cf1:col':( b'value')}

但我想要像...

找到:b'row1',{b'cf1:col':( b'value',timestamp)}

}

for key, data in table.scan():
print('Found: {}, {}'.format(key, data))

I have an HBase table that I need to scan and print the timestamp. I have written the above code but it only produces output like...

Found: b'row1', {b'cf1:col':(b'value')}

But I want output like...

Found: b'row1', {b'cf1:col':(b'value', timestamp)}

Any idea guys?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只想待在家 2025-01-25 13:16:02

默认情况下,HBASE在您返回的结果中不包括时间戳。您可以使用Happybase检索它们。要获得它们,您的应用程序需要具有timestamps_include

row = table.row(b'row-key', columns=[b'cf1:col1'], include_timestamp=True)
value, timestamp = row[b'cf1:col1']

然后您可以使用,

for key, data in table.scan(include_timestamp=True):
   print('Found: {}, {}'.format(key, data))

By default, HBase does not include timestamps in the results you return. You can use HappyBase to retrieve them. To get them, your application needs to have timestamps_include,

row = table.row(b'row-key', columns=[b'cf1:col1'], include_timestamp=True)
value, timestamp = row[b'cf1:col1']

And after that, you can use,

for key, data in table.scan(include_timestamp=True):
   print('Found: {}, {}'.format(key, data))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文