def truncate_log_metadata(self): for cf in ['build_timelines']: cf = ColumnFamily(self.pool, cf) cf.truncate() cf = ColumnFamily(self.pool, 'indices') for key in LOG_METADATA_INDICES: cf.remove(key) cf = ColumnFamily(self.pool, 'counters') for key in LOG_METADATA_COUNTERS: cf.remove(key) cf = ColumnFamily(self.pool, 'super_counters') for key in LOG_METADATA_SUPER_COUNTERS: cf.remove(key) cf = ColumnFamily(self.pool, 'builds') batch = cf.batch() # Remove log parsing state from builds. for key, cols in cf.get_range(columns=['log_parsing_version']): if 'log_parsing_version' not in cols: continue batch.remove(key, ['log_parsing_version']) batch.send()
def truncate_build_metadata(self): """Truncates all derived build metadata. This bulk removes all build metadata and should not be performed unless you want to reload all derived data! """ for cf in ['slaves', 'masters', 'builders', 'builds']: cf = ColumnFamily(self.pool, cf) cf.truncate() cf = ColumnFamily(self.pool, 'indices') for key in BUILD_METADATA_INDICES: cf.remove(key) cf = ColumnFamily(self.pool, 'simple_indices') for key in BUILD_METADATA_SIMPLE_INDICES: cf.remove(key) cf = ColumnFamily(self.pool, 'counters') for key in BUILD_METADATA_COUNTERS: cf.remove(key) cf = ColumnFamily(self.pool, 'super_counters') for key in BUILD_METADATA_SUPER_COUNTERS: cf.remove(key)
for i in keycoll : nbread+=1 res = col_fam.get(str(i)) end=datetime.datetime.utcnow() result=end-start print "read time: ", result print "read time per record: ", result/nbread print "" print "******Delete******" start=datetime.datetime.utcnow() #col_fam.remove('John') col_fam.truncate() end=datetime.datetime.utcnow() result=end-start print "delete time: ", result print "delete time per record: ", result/NUM_INSERT print "" print "******Drop******" start=datetime.datetime.utcnow() end=datetime.datetime.utcnow() result=end-start
print count count=author_cf.multiget_count(["sacharya1","sacharya2"]) print count ################################## REMOVE ##################################### # Remove the column for the row key and column key print "Removing the column last_name for row key sacharya1" author_cf.remove('sacharya1', columns=['last_name']) time.sleep(5) authors = author_cf.get('sacharya') print authors # REMOVE the entire row author_cf.remove('sacharya') try: time.sleep(5) print "Getting object already deleted" author_cf.get('sacharya') except Exception as e: print e # Delete all data from column family author_cf.truncate() ############################### DROP KEYSPACE ################################# sys.drop_keyspace('entries') pool.dispose()