def _execute_statement(model, statement, consistency_level, timeout): params = statement.get_context() s = SimpleStatement(str(statement), consistency_level=consistency_level, fetch_size=statement.fetch_size) if model._partition_key_index: key_values = statement.partition_key_values(model._partition_key_index) if not any(v is None for v in key_values): parts = model._routing_key_from_values(key_values, connection.get_cluster().protocol_version) s.routing_key = parts s.keyspace = model._get_keyspace() return connection.execute(s, params, timeout=timeout)
def _execute_statement(model, statement, consistency_level, timeout): params = statement.get_context() s = SimpleStatement(str(statement), consistency_level=consistency_level, fetch_size=statement.fetch_size) if model._partition_key_index: key_values = statement.partition_key_values(model._partition_key_index) if not any(v is None for v in key_values): parts = model._routing_key_from_values(key_values, connection.get_cluster().protocol_version) s.routing_key = parts s.keyspace = model._get_keyspace() return connection.execute(s, params, timeout=timeout)
def _prepare_query_statement(self, query, query_statement): params = query_statement.get_context() statement = SimpleStatement( str(query_statement), consistency_level=query.consistency, fetch_size=query_statement.fetch_size, ) if query.model._partition_key_index: key_values = query_statement.partition_key_values( query.model._partition_key_index) if not any(v is None for v in key_values): parts = query.model._routing_key_from_values( key_values, self.cluster.protocol_version) statement.routing_key = parts statement.keyspace = self.keyspace return statement, params