From https://developers.google.com/appengine/docs/python/datastore/transactions
from google.appengine.ext import dbxg_on = db.create_transaction_options(xg=True)def my_txn(): x = MyModel(a=3) x.put() y = MyModel(a=7) y.put()db.run_in_transaction_options(xg_on, my_txn)