使用python从Cassandra检索日期时出现奇怪的结果
我使用的是使用python从Cassandra检索日期时出现奇怪的结果,python,cassandra,cql,Python,Cassandra,Cql,我使用的是Cassandraversion2.0.1和python以及cql1.4库。 这是表仪器的说明: CREATE TABLE instruments ( key text, field text, valid_date timestamp, publication_date timestamp, insertion_date timestamp, value text, PRIMARY KEY (key, field, valid_date, publicat
Cassandra
version2.0.1和python以及cql
1.4库。
这是表仪器的说明:
CREATE TABLE instruments (
key text,
field text,
valid_date timestamp,
publication_date timestamp,
insertion_date timestamp,
value text,
PRIMARY KEY (key, field, valid_date, publication_date, insertion_date)
) WITH CLUSTERING ORDER BY (field ASC, valid_date DESC, publication_date DESC, insertion_date DESC) AND
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=864000 AND
index_interval=128 AND
read_repair_chance=0.100000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
default_time_to_live=0 AND
speculative_retry='NONE' AND
memtable_flush_period_in_ms=0 AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'LZ4Compressor'};
将cqlsh与查询一起使用:
select key, field, valid_date, publication_date, insertion_date, value from instruments where key='instrument1' and field='currency' and valid_date <= 1376524800000;
但在python程序中使用cql时,我得到:
list: [u'instrument1', u'currency', '\x00\x00\x01@\x7fE\x90\x00', '\x00\x00\x01@\x7fE\x90\x00', '\x00\x00\x01@\x7fE\x90\x00', u'USD']
如何从数据库中正确检索结果?当我将casssandra server升级到2.0时会出现此问题是的可能重复我认为这是相同的问题。但是还没有好的解决方案,目前我必须回到以前版本的Cassandra,以便继续该项目,谢谢!您尝试过datastax python驱动程序吗?没有,但正如他们所说,目前不建议将其用于生产,我更愿意切换回以前的版本
list: [u'instrument1', u'currency', '\x00\x00\x01@\x7fE\x90\x00', '\x00\x00\x01@\x7fE\x90\x00', '\x00\x00\x01@\x7fE\x90\x00', u'USD']