MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / set_keyspace_blocking

Method set_keyspace_blocking

cassandra/connection.py:1508–1531  ·  view source on GitHub ↗
(self, keyspace)

Source from the content-addressed store, hash-verified

1506 raise ProtocolError(msg % (self.endpoint, auth_response))
1507
1508 def set_keyspace_blocking(self, keyspace):
1509 if not keyspace or keyspace == self.keyspace:
1510 return
1511
1512 query = QueryMessage(query='USE "%s"' % (keyspace,),
1513 consistency_level=ConsistencyLevel.ONE)
1514 try:
1515 result = self.wait_for_response(query)
1516 except InvalidRequestException as ire:
1517 # the keyspace probably doesn't exist
1518 raise ire.to_exception()
1519 except Exception as exc:
1520 conn_exc = ConnectionException(
1521 "Problem while setting keyspace: %r" % (exc,), self.endpoint)
1522 self.defunct(conn_exc)
1523 raise conn_exc
1524
1525 if isinstance(result, ResultMessage):
1526 self.keyspace = keyspace
1527 else:
1528 conn_exc = ConnectionException(
1529 "Problem while setting keyspace: %r" % (result,), self.endpoint)
1530 self.defunct(conn_exc)
1531 raise conn_exc
1532
1533 def set_keyspace_async(self, keyspace, callback):
1534 """

Callers 6

_prepare_all_queriesMethod · 0.80
__init__Method · 0.80
_replaceMethod · 0.80
__init__Method · 0.80

Calls 5

wait_for_responseMethod · 0.95
defunctMethod · 0.95
QueryMessageClass · 0.90
ConnectionExceptionClass · 0.85
to_exceptionMethod · 0.45

Tested by 1