本文介绍了Cross Group(XG)交易和使用的进一步解释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 最新版本的GAE指出以下变化: lockquote 数据存储 交叉组(XG)交易:对于那些需要交易写入给多个实体组中的实体(这就是所有人,对吧?), XG交易就是这样。此功能使用两阶段提交,使交叉组写入原子就像单组写入。 我想我可以使用这是我刚刚创建的项目代码中的更改,但我希望获得有关此App更新的更多信息。我似乎无法找到任何其他信息。所以...... 与此更新有关的编码事务是如何改变的?用外行人的话说,我该如何实现一个跨组交易,而且我还需要知道的数据存储交易还有一些限制吗? 我知道这是一个相当模糊的问题。我的问题是,这听起来很有用,但我不知道如何正确(和有效)使用此更改。 解决方案您是否阅读过任何文档?这听起来像你没有(根据你说我似乎无法找到任何额外的信息)。在这种情况下,请查看下面的链接,看看是否还有任何问题。 从概念上讲,进行跨组交易与典型的GAE交易非常相似, ,并且只能在HRD中使用。请注意,一般来说,GAE事务,正常和XG具有不同于您可能用来从SQL数据库获得的隔离特性。第二个链接在XG部分之后立即进行讨论。 以下是第一个链接的摘录,显示了使用XG的简单程度。 from google.appengine.ext import db xg_on = db.create_transaction_options(xg = True) def my_txn():x = MyModel(a = 3) x.put()y = MyModel(a = 7) y.put() $ $ b 快速示例 稍微更详细一点 The most recent release of the GAE states the following changes:I think I could use this change within the code of a project I created a while ago but I would like further information regarding this update to the App Engine. I can't seem to find any additional information. So...How has coding transactions changed, in regards to this update? In layman's terms, how can I implement a cross-group transaction and are there still some limitations to data store transactions that I need to be aware of?I know this is a rather vague question. My problem is that this sounds very useful, but I'm not sure how to correctly (and effectively) use this change. 解决方案 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 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)quick exampleslightly more detail 这篇关于Cross Group(XG)交易和使用的进一步解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-24 20:08