insert_time_1 = process_time() print("Inserting 10k records took: \t\t\t", insert_time_1 - insert_time_0) # Measuring update Performance update_cols = [ [randrange(0, 100), None, None, None, None], [None, randrange(0, 100), None, None, None], [None, None, randrange(0, 100), None, None], [None, None, None, randrange(0, 100), None], [None, None, None, None, randrange(0, 100)], ] update_time_0 = process_time() for i in range(0, 10000): query.update(choice(keys), *(choice(update_cols))) update_time_1 = process_time() print("Updating 10k records took: \t\t\t", update_time_1 - update_time_0) # Measuring Select Performance select_time_0 = process_time() for i in range(0, 10000): query.select(choice(keys), [1, 1, 1, 1, 1]) select_time_1 = process_time() print("Selecting 10k records took: \t\t\t", select_time_1 - select_time_0) # Measuring Aggregate Performance agg_time_0 = process_time() for i in range(0, 10000, 100): query.sum(i, 100, randrange(0, 5)) agg_time_1 = process_time()
for i, column in enumerate(record.columns): if column != records[key][i]: error = True if error: print('select error on', key, ':', record, ', correct:', records[key]) else: print('select on', key, ':', record) for key in records: updated_columns = [None, None, None, None, None] for i in range(1, grades_table.num_columns): value = randint(0, 20) updated_columns[i] = value original = records[key].copy() records[key][i] = value query.update(key, *updated_columns) record = query.select(key, [1, 1, 1, 1, 1])[0] error = False for j, column in enumerate(record.columns): if column != records[key][j]: error = True if error: print('update error on', original, 'and', updated_columns, ':', record, ', correct:', records[key]) else: print('update on', original, 'and', updated_columns, ':', record) updated_columns[i] = None keys = sorted(list(records.keys())) for c in range(0, grades_table.num_columns): for i in range(0, 20):