I'm having a bug where my python code can't find a record in Cassandra and it seems to boil down to differences in the minTimeuuid/maxTimeuuid functions in cqlsh versus the python driver.
When I run a query in cqlsh (the ts column is a TimeUUID):
cqlsh:mydb> SELECT minTimeuuid(unixTimestampOf(ts)), maxTimeuuid(unixTimestampOf(ts)), unixTimestampOf(ts), dateOf(ts) from mytable where ...;
minTimeuuid(unixTimestampOf(ts)) | maxTimeuuid(unixTimestampOf(ts)) | unixTimestampOf(ts) | dateOf(ts)
--------------------------------------+--------------------------------------+---------------------
177dc170-b8e3-11e1-8080-808080808080 | 177de87f-b8e3-11e1-7f7f-7f7f7f7f7f7f | 1339982128903 | 2012-06-18 03:15:28+0200
When I run the same thing in Python:
Python 2.7.12 (default, Oct 8 2019, 14:14:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cassandra.util
>>> from datetime import datetime
>>> dt = datetime(2012,6,18,1,15,28,903000)
>>> cassandra.util.max_uuid_from_time(dt)
UUID('177dc170-b8e3-11e1-bf7f-7f7f7f7f7f7f')
>>> cassandra.util.min_uuid_from_time(dt)
UUID('177dc170-b8e3-11e1-8080-808080808080')
Note that the min versions are identical but the max time uuid are not:
Min (cqlsh first): | Max (cqlsh first):
177dc170-b8e3-11e1-8080-808080808080 | 177de87f-b8e3-11e1-7f7f-7f7f7f7f7f7f
177dc170-b8e3-11e1-8080-808080808080 | 177dc170-b8e3-11e1-bf7f-7f7f7f7f7f7f
I don't understand how they can be different, any ideas? I've tried the same things under Python 3.5.2 rather than 2.7 as above with same results.