开发者

What does ancestor mean in the google app engine datastore

开发者 https://www.devze.com 2022-12-24 11:25 出处:网络
Can anyone tell or define more what is \"ancestor\" and g开发者_JAVA技巧ive an example on it and also what it is for? I just can\'t grasp what it really is.

Can anyone tell or define more what is "ancestor" and g开发者_JAVA技巧ive an example on it and also what it is for? I just can't grasp what it really is.

Reference: http://code.google.com/appengine/docs/python/datastore/queryclass.html#Query_ancestor

Thanks.


Transactions in GAE only exist within ancestor-descendant groups. Equivalently, quoting the docs at the URL I just gave,

All datastore operations in a transaction must operate on entities in the same entity group

and an "entity group", per this page in the docs, are defined by:

When the application creates an entity, it can assign another entity as the parent of the new entity, using the parent argument in the Model constructor. Assigning a parent to a new entity puts the new entity in the same entity group as the parent entity.

"Ancestor" is just the transitive closure of "parent" -- i.e., given an entity, its ancestors are, its parent, its parent's parent, and so forth.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号