Thanks! I start to get the hang of it!

On Apr 12, 7:10 am, Waleed Abdulla <[email protected]> wrote:
> You're on the right track.
>
> class User(db.Model):
>   uid = db.IntegerProperty()
>   score = db.IntegerProperty()
>   friends = db.ListProperty(int)
>
> 1. Global high score.
>     select * from User order by score desc
>
> 2. Friend's high score
>
> select * from User where friends = <user id here> order by score desc
>
> This works if you have an index on friends and score (desc). And because the
> uid of the user in question will be in the list of "friends" of all his
> friends, so basically the condition of friends = uid will limit the result
> to the friends of that user. The only missing component here is that the
> user himself won't be in the list. You can get around that by either adding
> the user id to the friends list (i.e. a user is a friend of himself) or by
> getting the results for the friends and then inserting the score of the
> user programmatically.
>
> Waleed
>
> On Sun, Apr 11, 2010 at 3:01 AM, Herbert <[email protected]> wrote:
> > hi all,
>
> > suppose i have a network of 100k users, each of them have 100 friends.
> > they're all playing some games and have scores , i want to do two
> > rankings: 1. global ranking, 2. ranking of friends. how am i going to
> > design my datastore for this?
>
> > can i do something like this?
>
> > class User(db.Model):
> >   uid = db.IntegerProperty()
> >   score = db.IntegerProperty()
> >   friends = db.ListProperty(int)
>
> > since we don't have join, i'm thining of putting ids of friends in a
> > listProperty like above, learning from a GAE presentation that
> > listproperty gets inefficient at (or limited to) 1k entries, which i
> > think it's more than enough for my app.
>
> > i think it's question of best practices for designing entities for GAE
> > without JOIN, yet i couldn't seem to find a discussion that nails what
> > i'm looking for. would be grateful if anyone could share some
> > thoughts.
>
> > the appengine's been great! thanks all GAE team!
>
> > Herbert
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.

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

Reply via email to