0

我正在尝试从 Cassandra 集群中获取数据。有一个问题,它有时会获取几行,有时没有行。
我正在使用 Python 3.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 
4

0 回答 0