I have a cluster of (Apache) Cassandra nodes on the GCP and Python3 on one VM. Using the "cqlsh --cqlshrc" the query that I need can be run without any error. Inside the cqlshrc there is costume timestamp and increased connection-timeout.
[copy] DATETIMEFORMAT = %m/%d/%Y %H:%M:%S
[connection] request_timeout = 6000
I Also have the "cqlshrc" file in the "~/.cassandra/" folder so I can use it without passing it as a parameter. Now the Python script which is using "cassandra-driver" wants to talk to Cassandra and run some queries, but I get this error:
Traceback (most recent call last): File "queries.py", line 10, in query1() File "queries.py", line 6, in query1 rows = session.execute('SELECT count(*) FROM freeway_loopdata WHERE speed > 100 ALLOW FILTERING') File "cassandra/cluster.py", line 2345, in cassandra.cluster.Session.execute File "cassandra/cluster.py", line 4304, in cassandra.cluster.ResponseFuture.result cassandra.ReadFailure: Error from server: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'consistency': 'LOCAL_ONE', 'required_responses': 1, 'received_responses': 0, 'failures': 1}
Which is from not increasing the timeout. How can I pass the "cqlshrc" file inside the Python script as some parameter?
cassandra.yaml
, how are you declaring thelisten_address
value? using anALLOW FILTERING
statement is an antipattern. – Carlos Monroy Nieblascqlshrc
. – Carlos Monroy Nieblasfrom cassandra.cluster import Cluster
cluster = Cluster(['0.0.0.0'],port=9042)
session = cluster.connect('cs588damon',wait_for_all_pools=True)
session.request_timeout=60000
session.execute('USE cs588damon')
– Damon