Skip to content Skip to sidebar Skip to footer

Cross Group (xg) Transactions And Further Explanation Of Use

The most recent release of the GAE states the following changes: Datastore Cross Group (XG) Transactions: For those who need transactional writes to entities in multiple entity

Solution 1:

Have you read any of the docs? It sounds like you haven't (based on you saying "I can't seem to find any additional information"). In that case, check out the links below and see if still have any questions.

Conceptually, doing a cross group transaction is pretty similar to a typical GAE transaction, just slower, and only available in the HRD. Note that in general, GAE transactions, both "normal" and XG have different isolation characteristics than what you may be used to coming from a SQL database. The second link discusses this immediately after the XG section.

Here is an excerpt from the first link showing how simple using XG can be.

from google.appengine.ext import db

xg_on = db.create_transaction_options(xg=True)

defmy_txn():
    x = MyModel(a=3)
    x.put()
    y = MyModel(a=7)
    y.put()

db.run_in_transaction_options(xg_on, my_txn)

Post a Comment for "Cross Group (xg) Transactions And Further Explanation Of Use"