Properly quote keyspace name in Session.set_keyspace()

This commit is contained in:
Tyler Hobbs
2014-03-19 14:06:19 -05:00
parent ca936e0f28
commit a6a5935be3
2 changed files with 4 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ Bug Fixes
called
* Avoid race condition that could leave ResponseFuture callbacks uncalled
if the callback was added outside of the event loop thread (github issue #95)
* Properly escape keyspace name in Session.set_keyspace(). Previously, the
keyspace name was quoted, but any quotes in the string were not escaped.
Other
-----

View File

@@ -31,7 +31,7 @@ from cassandra.decoder import (QueryMessage, ResultMessage,
PreparedQueryNotFound,
IsBootstrappingErrorMessage, named_tuple_factory,
dict_factory)
from cassandra.metadata import Metadata
from cassandra.metadata import Metadata, protect_name
from cassandra.policies import (RoundRobinPolicy, SimpleConvictionPolicy,
ExponentialReconnectionPolicy, HostDistance,
RetryPolicy)
@@ -1253,7 +1253,7 @@ class Session(object):
Set the default keyspace for all queries made through this Session.
This operation blocks until complete.
"""
self.execute('USE "%s"' % (keyspace,))
self.execute('USE %s' % (protect_name(keyspace),))
def _set_keyspace_for_all_pools(self, keyspace, callback):
"""