Can I specify the order of how changes happen in an single App Engine transaction ? Is it equal to t
- by indiehacker
If I passed a list of key ids as an argument in a transaction, would the change associated with the first key in the list happen first? And if not, how do I specify the order that I want the changes to happen in?
As a concrete example, consider this code below from Google Docs Transactions--would changes to the first item in acc.key() happen first?
class Accumulator(db.Model):
counter = db.IntegerProperty()
Docshttp://code.google.com/appengine/docs/python/datastore/transactions.html:
def increment_counter(key, amount):
obj = db.get(key)
obj.counter += amount
obj.put()
q = db.GqlQuery("SELECT * FROM Accumulator")
acc = q.get()
db.run_in_transaction(increment_counter, acc.key(), 5)