Reputation: 271
When running the query.
"select * from temperature_by_day"
Cassandra is returning a string '\x00\x00\x017\xa7\xea\x9e\x00' for the timestamp.
If I query from cqlsh on the server it returns the dates I've set.
I've read this post: How to retrieve the timestamp from cassandra?
It states "It's not recommended to use column Cassandra timestamps directly in client code;".
Why?
The tutorial here states to query the timestamp directly.
http://planetcassandra.org/blog/post/getting-started-with-time-series-data-modeling/
So is the proper thing to do to add an additional timestamp that is not part of the primary key and query against this timestamp?
Thanks in advance.
Upvotes: 2
Views: 1122
Reputation: 4012
The Datastax Python driver supports the timestamp type. If you want to learn how to deserialize it check out the DataType.deserialize method:
return datetime.utcfromtimestamp(int64_unpack(byts) / 1000.0)
Upvotes: 2