Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

rip out CQL support

following the example of Hector, i think Telephus should probably just
not support CQL queries. Rationale: I don't want Telephus to be in the
business of parsing random CQL queries, and without that, there would
be no way to tell when the user changed the connection's keyspace.

Maybe PyTx should be resurrected to provide a Twisted-friendly CQL
driver, or maybe cassandra-dbapi2 would work fine with
twisted.enterprise.adbapi if that's what people want.

A quick survey of known telephus users indicated no one uses this from
telephus anyway. And if someone does, they could access the thrift
Client object themselves and hack in support for execute_cql_query.
They'd need to add their own hooks to let Telephus know when the
keyspace changed, or simply refrain from ever using 'USE'.
  • Loading branch information...
commit b9aa9713a965139e8f009656b6a781612a9e034d 1 parent b7bfed1
@thepaul thepaul authored
Showing with 1 addition and 30 deletions.
  1. +1 −6
  2. +0 −5 telephus/
  3. +0 −19 test/
@@ -1,8 +1,7 @@
from telephus.protocol import ManagedCassandraClientFactory
from telephus.client import CassandraClient
-from telephus.cassandra.ttypes import (ColumnPath, ColumnParent, Column,
- SuperColumn, Compression)
+from telephus.cassandra.ttypes import ColumnPath, ColumnParent, Column, SuperColumn
from twisted.internet import defer
HOST = 'localhost'
@@ -48,10 +47,6 @@ def dostuff(client):
column='testcounter', super_column='testsuper')
print 'get super counter value', res
- res = yield client.execute_cql_query("SELECT * FROM %s WHERE KEY = %s" % (CF, 'test'.encode('hex')),
- compression=Compression.NONE)
- print 'execute_cql_query', res
# batch insert will figure out if you're trying a CF or SCF
# from the data structure
res = yield client.batch_insert(key='test', column_family=CF, mapping={colname: 'bar'})
5 telephus/
@@ -226,11 +226,6 @@ def batch_mutate(self, mutationmap=None, timestamp=None, consistency=None, retri
req = ManagedThriftRequest('batch_mutate', mutmap, consistency)
return self.manager.pushRequest(req, retries=retries)
- @requirekwargs('query')
- def execute_cql_query(self, query=None, compression=Compression.GZIP, retries=None):
- req = ManagedThriftRequest('execute_cql_query', query, compression)
- return self.manager.pushRequest(req, retries=retries)
def _mk_cols_or_supers(self, mapping, timestamp, ttl=None, make_deletions=False):
if isinstance(mapping, list):
return mapping
19 test/
@@ -7,7 +7,6 @@
from telephus.cassandra.ttypes import *
from telephus.translate import getAPIVersion, CASSANDRA_08_VERSION
import os
-import zlib
@@ -247,24 +246,6 @@ def test_counter_remove(self):
column='col', super_column='scol'),
- @defer.inlineCallbacks
- def test_cql(self):
- if self.version != CASSANDRA_08_VERSION:
- raise unittest.SkipTest('CQL is not supported in 0.7')
- yield self.client.insert('test', CF, 'testval', column='col1')
- res = yield self.client.get('test', CF, column='col1')
- self.assertEquals(res.column.value, 'testval')
- query = 'SELECT * from %s where KEY = %s' % (CF, 'test'.encode('hex'))
- uncompressed_result = yield self.client.execute_cql_query(query, Compression.NONE)
- self.assertEquals(uncompressed_result.rows[0].columns[0].name, 'col1')
- self.assertEquals(uncompressed_result.rows[0].columns[0].value, 'testval')
- compressed_query = zlib.compress(query)
- compressed_result = yield self.client.execute_cql_query(compressed_query, Compression.GZIP)
- self.assertEquals(uncompressed_result, compressed_result)
def sleep(self, secs):
d = defer.Deferred()
reactor.callLater(secs, d.callback, None)
Please sign in to comment.
Something went wrong with that request. Please try again.