user1500824
user1500824

Reputation: 69

is an entity stores the first parent

Does an entity only stores the first parent? or all parents on its own key.

And how many child can be create.

I want to learn if an entity only saves its parent or the all top parents on KEY.

Thank You

Upvotes: 0

Views: 51

Answers (1)

proppy
proppy

Reputation: 10504

An entity key encode the entity kind, name or id of the entity, and all the entity ancestor keys.

Example for a -> b -> c (with -> = parent_of):

>>> a = Foo(id="a").put()
>>> b = Foo(id="b", parent=a).put()
>>> c = Foo(id="c", parent=b).put()
>>> c
Key('Foo', 'a', 'Foo', 'b', 'Foo', 'c')

See this article for more explanation on how entity are stored.

Upvotes: 2

Related Questions