def delete(self, cascade=True): # TODO: batch operation del_query = CassandraQuery(self.domain, CassandraQuery.OP_BATCH_DELETE, self, cascade=cascade) del_query.execute_query()
def filterObj(domain, qObj=None, **predicate_dict): query = CassandraQuery(domain, CassandraQuery.OP_SELECT) query.add_filter_object(qObj) query.add_filter_statements(predicate_dict) query.set_fetch_limits(0, 1) return query.execute_query()
def getObj(domain, row_key): query = CassandraQuery(domain, CassandraQuery.OP_SELECT) query.set_fetch_limits(row_key, 1) try: ## result is a dict of {column : value} result = query.execute_query() env = Environment(row_key, result['ownerID'], result['name'], result['category']) return env except Exception, ex: print ex return None
def filterCollection(domain, offset = 0, limit = 100, qObj = None, **predicate_dict): query = CassandraQuery(domain, CassandraQuery.OP_FETCH) query.add_filter_object(qObj) query.add_filter_statements(predicate_dict) query.set_fetch_limits(offset, limit) return query.execute_query()
def filterCollection(domain, offset=0, limit=100, qObj=None, **predicate_dict): query = CassandraQuery(domain, CassandraQuery.OP_FETCH) query.add_filter_object(qObj) query.add_filter_statements(predicate_dict) query.set_fetch_limits(offset, limit) return query.execute_query()
def getCollection(domain, offset = 0, limit = 100): query = CassandraQuery(domain, CassandraQuery.OP_FETCH) query.set_fetch_limits(offset, limit) return query.execute_query()
def delete(self, cascade = True): # TODO: batch operation del_query = CassandraQuery(self.domain, CassandraQuery.OP_BATCH_DELETE, self, cascade=cascade) del_query.execute_query()
def save(self): # TODO: batch operation ins_query = CassandraQuery(self.domain, CassandraQuery.OP_BATCH_INSERT, self) ins_query.execute_query()
def getCollection(domain, offset=0, limit=100): query = CassandraQuery(domain, CassandraQuery.OP_FETCH) query.set_fetch_limits(offset, limit) return query.execute_query()
def getObj(domain, row_key): query = CassandraQuery(domain, CassandraQuery.OP_SELECT) query.set_fetch_limits(row_key, 1) return query.execute_query()
def delete(self, cascade = True): del_query = CassandraQuery(self.domain, CassandraQuery.OP_DELETE, self, cascade = cascade) del_query.execute_query()
def save(self): ins_query = CassandraQuery(self.domain, CassandraQuery.OP_INSERT, self) ins_query.execute_query()