If I want to update all the amounts of the inputs of an activity (with different values), I would have to iterate over the technosphere of the activity, update the amount field per exchange, and call "save()" on each exchange. With n technosphere exchanges, this requires n transactions, in current implementation.
I would like to group the updates, so that there is only one transaction, and hopefully less I/O to hardrive.
something in the line of:
""" exchanges is a dictionary of oldExchange:newExchange """ def bulk_update_exchanges(activity, exchanges): with db.atomic as txn: for old, new in exchanges.items(): old.update(data = new.data)