2

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.

Community
  • 1
  • 1
EnergyGeek
  • 271
  • 1
  • 4
  • 14

1 Answers1

2

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)
Alex Popescu
  • 3,982
  • 18
  • 20
  • I seem to be having difficulty installing the cassandra-driver. I'm stuck. It's complaining about File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in query_vcvarsal l raise ValueError(str(list(result.keys()))) ValueError: [u'path'] – EnergyGeek Apr 29 '14 at 22:46
  • Thanks Alex, I was able to get the driver installed and running. – EnergyGeek May 01 '14 at 17:22