Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient way to get child entity/keys given a parent

I wanted to ask if there is a direct and efficient way to get the child of a parent entity.

I am modelling a follower/ following relationship(like twitter). So I have a user model and a message model. I have a Follower and Following model which have a user model as a parent.

So whenever a user writes a message(or say tweet), all his followers should be able to get that. In this case I need to figure out who are the followers of the user(who sends a message).

Any help is greatly appreciated

like image 965
Joydeep sinha Avatar asked Oct 07 '22 16:10

Joydeep sinha


1 Answers

Use ancestor queries. https://developers.google.com/appengine/docs/python/datastore/queryclass#Query_ancestor Or https://developers.google.com/appengine/docs/python/ndb/queries#ancestor

like image 114
Guido van Rossum Avatar answered Oct 13 '22 11:10

Guido van Rossum