Unknown code 10 for a consistency level

10,597 views
Skip to first unread message

Stephen Dimig

unread,
Feb 20, 2016, 12:24:28 PM2/20/16
to DataStax Python Driver for Apache Cassandra User Mailing List
I have tried like 8 different pyspark/python -> Cassandra drivers (including JDBC) and I just can't connect. I get this:

>>> session.execute(''' SELECT * mykeyspace.foo ''').default_consistency_level=ConsistencyLevel.ANY
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'ConsistencyLevel' is not defined
>>> session.execute(''' SELECT * mykeyspace.foo ''').consistency_level=0Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cassandra/cluster.py", line 1572, in cassandra.cluster.Session.execute (cassandra/cluster.c:27084)
  File "cassandra/cluster.py", line 3133, in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:60157)
cassandra.protocol.ProtocolException: <ErrorMessage code=000a [Protocol error] message="Unknown code 10 for a consistency level">


I tried pulling the python-driver code down from git and building it locally but still get the same error. 

cqlsh> SHOW VERSION
[cqlsh 3.1.7 | Cassandra 1.2.10 | CQL spec 3.0.0 | Thrift protocol 19.36.0]

[root@sandbox cassandra]# uname -a
Linux sandbox.hortonworks.com 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Spark version: 1.3
Python: 2.6.6

I have spent like a million hours on this.

Alex Popescu

unread,
Feb 20, 2016, 2:37:53 PM2/20/16
to python-dr...@lists.datastax.com
The default consistency must be set on the `session` object. `session.execute` returns a result after the query has been already executed.

--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.



--
Bests,

Alex Popescu | @al3xandru
Sen. Product Manager @ DataStax

Andrew Tolbert

unread,
Feb 20, 2016, 3:02:04 PM2/20/16
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi Stephen,
 
[cqlsh 3.1.7 | Cassandra 1.2.10 | CQL spec 3.0.0 | Thrift protocol 19.36.0]

 <ErrorMessage code=000a [Protocol error] message="Unknown code 10 for a consistency level">
 
I was curious about this as I had thought C* 1.2 supports LOCAL_ONE.  I turns out LOCAL_ONE was not added until Cassandra 1.2.11, and it was added with the wrong code (0x8 instead of 0x10).  This was fixed by CASSANDRA-6347 in 1.2.12.

As Alex suggests you can configure the default CL on the Session object.   One small note is that the driver used to use CL ONE as the default CL, but that was changed to LOCAL_ONE in python driver 3.0.

Thanks,
Andy

Stephen Dimig

unread,
Feb 20, 2016, 3:43:35 PM2/20/16
to DataStax Python Driver for Apache Cassandra User Mailing List
Man, guys. That worked!!!! I was so frustrated by that. Thank you!
Reply all
Reply to author
Forward
0 new messages