I am having trouble with one specific query. It needs to run in a transaction, and it does, but whenever the app engine executes my query I get the following error:
Only ancestor queries are allowed inside transactions
You'll see that my query DOES have an ancestor. So what is the app engine really complaining about?
q = db.Query(EventBase)
q.ancestor = db.Key.from_path(aggrRootKind, aggrRootKeyName)
q.filter('undone =','False')
q.order('-version')
qResult = q.fetch(1, 0)
This line:
q.ancestor = db.Key.from_path(aggrRootKind, aggrRootKeyName)
should read:
q.ancestor(db.Key.from_path(aggrRootKind, aggrRootKeyName))
ancestor() is a method, and in the first snippet, you're replacing it, rather than calling it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.