I feel kind of silly about this, but I'm having trouble wrapping my
head around quite the right way to do something with the GAE
datastore. I think I know how I would do it with a classic relational
database, but...

I've got a model for a "user" which has a key_name of the user's id #.
One of the things I would like a user to be able to have is a list of
friends, which would be other users in the store. I'd like to have a
way to calculate a user's list of friends and friends-of-friends
efficiently.

I think in a traditional DB I would have a "friendship" table with a
user1 and user2 column, into which I'd first make a query for any
entries with columns matching my user's ID and take all the "other"
IDs to be my user's friends, then feed those back in for a second
round to get friends-of-friends. Then again I'm mostly a client guy
and what I just described may cause server/db people to weep or laugh
uncontrollably ;)

That said, I am just not clear on how I should be doing this with the
GAE datastore. I have some inkling that maybe I should be using a list
property to track a user's friends, and then do a query for all the
friends with ids that are in that list, and creating a Set of all
THEIR friend lists to get friends-of-friends? Am I thinking about this
the right way, or am I way off base? If that is correct am I going to
run into any result-limit/performance landmines if a user has a couple
hundred friends? If I'm way off base can anyone point the way?

I was never much good with DBs, and now it seems the small bits of
knowledge I've managed to scrape together are mostly useless, so any
advice folks can provide would be much appreciated.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to