我正在尝试从cassandra集群获取数据。有一个问题,它有时获取几行,有时没有行。
我使用的是python3.8.5和最新的datastax python驱动程序。
下面是代码
from cassandra.cluster import Cluster
from cassandra.query import SimpleStatement
cluster = Cluster(['xx.xx.x.xx','xx.xx.x.xx','xx.xx.x.xx'])
session = cluster.connect('keyspace')
query = "SELECT * from table ALLOW FILTERING" # Allow Filtering is for test
statement = SimpleStatement(query)
for user_row in session.execute(statement):
print(user_row)
整句话有时会有结果,有时却没有结果。
我已按建议启用跟踪,以查看下面的执行结果
0:00:00.000150 Parsing SELECT * from table ALLOW FILTERING
0:00:00.000271 Preparing statement
0:00:00.000425 Computing ranges to query
0:00:00.000654 Submitting range requests on 769 ranges with a concurrency of 1 (0.0 rows per range expected)
0:00:00.001804 Submitted 1 concurrent range requests
0:00:00.001839 Executing seq scan across 0 sstables for (min(-9223372036854775808), min(-9223372036854775808)]
0:00:00.001924 Read 0 live rows and 0 tombstone cells
暂无答案!
目前还没有任何答案,快来回答吧!