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

Method using

cassandra/cqlengine/query.py:1027–1043  ·  view source on GitHub ↗

Change the context on-the-fly of the Model class (keyspace, connection)

(self, keyspace=None, connection=None)

Source from the content-addressed store, hash-verified

1025 return clone
1026
1027 def using(self, keyspace=None, connection=None):
1028 """
1029 Change the context on-the-fly of the Model class (keyspace, connection)
1030 """
1031
1032 if connection and self._batch:
1033 raise CQLEngineException("Cannot specify a connection on model in batch mode.")
1034
1035 clone = copy.deepcopy(self)
1036 if keyspace:
1037 from cassandra.cqlengine.models import _clone_model_class
1038 clone.model = _clone_model_class(self.model, {'__keyspace__': keyspace})
1039
1040 if connection:
1041 clone._connection = connection
1042
1043 return clone
1044
1045
1046class ResultObject(dict):

Callers 5

test_keyspaceMethod · 0.80
test_connectionMethod · 0.80
createMethod · 0.80

Calls 2

CQLEngineExceptionClass · 0.90
_clone_model_classFunction · 0.90

Tested by 4

test_keyspaceMethod · 0.64
test_connectionMethod · 0.64