如何从 cassandra 检索时间戳? [英] How to retrieve the timestamp from cassandra?

查看:58
本文介绍了如何从 cassandra 检索时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的 cassandra 中,获取结果"..我们可以检索列名和值.但是如何检索时间戳..是否有更好的主意通过使用时间戳获取值

In the below cassandra, "get result"..we can able to retrieve the column name and values. But how to retrieve the timestamp..Is there any better idea to get the values by using timestamp

[default@sample]get user[bob];                                        
=> (column=name, value=bobdroid, timestamp=1335361733545850)
=> (column=email, value=bob@gmail.com, timestamp=1335361733545850)
=> (column=age, value=23, timestamp=1335361733545850)
=> (column=password, value=MTIz, timestamp=1335361733545850)
Returned 4 results.
Elapsed time: 4 msec(s).

推荐答案

不建议在客户端代码中直接使用列 Cassandra 时间戳;理想情况下,您应该以最适合您的架构的任何形式添加自己的时间戳.但如果你真的想要,它可以通过 thrift 接口完成(并且,通过扩展,使用 thrift 接口的某些库).

It's not recommended to use column Cassandra timestamps directly in client code; ideally, you should add your own timestamps in whatever form is most appropriate to your schema. But if you really want to, it can be done through the thrift interface (and, by extension, certain libraries using the thrift interface).

对于 pycassa 情况,您只需将 include_timestamp=True 添加到您的 .get() 调用的参数中.对于 CQL、cqlsh 和 cassandra-cli 的情况,我认为完全没有办法获得时间戳,抱歉.

For the pycassa case, you just need to add include_timestamp=True to the arguments for your .get() call. For the CQL, cqlsh, and cassandra-cli cases, I believe there's totally no way to get the timestamp, sorry.

这篇关于如何从 cassandra 检索时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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