Can I specify the order of how changes happen in an single App Engine transaction ? Is it equal to t
Posted
by indiehacker
on Stack Overflow
See other posts from Stack Overflow
or by indiehacker
Published on 2010-03-14T12:50:36Z
Indexed on
2010/03/14
12:55 UTC
Read the original article
Hit count: 311
google-app-engine
|transactions
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)
© Stack Overflow or respective owner