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

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

问题描述

在下面的cassandra中,get result..我们可以检索列名和值。但是如何检索时间戳。有任何更好的想法,通过使用时间戳获取值

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 case,你只需要为 .get()调用的参数添加 include_timestamp = True 。对于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天全站免登陆