On Fri, Jul 10, 2009 at 2:04 PM, neil souza<[email protected]> wrote:
>
> the problem:
>
> how to best structure the id system for a social network app on app
> engine.
>
>
> the run down:
>
> users access the app through a social network. they identify
> themselves to the app with a 'platform type id' (pl_type_id, enum) and
> 'platform user id' (pl_user_id, 64bit int) pair. examples: user 12345
> at facebook, user 45678 at myspace, etc.
>
> we need to be able to find their data using that pair. we also need to
> be able to find their friend's data using lists of the same sort of
> pairs.
>
> let's say for the sake of simplicity that each user has a User object
> in the datastore. we need to be able to efficiently fetch a specific
> User object using a (pl_type_id, pl_user_id) pair, and fetch a list of
> User objects (up to say 1000) using a list of (pl_type_id, pl_user_id)
> pairs.
>
>
> ideas thus far:
>
> 1.) User has integer properties for pl_user_id and pl_type_id.
> resolving one user object is no issue, resolving many requires an 'IN'
> query, which is not viable since it makes 1 query for each pair in the
> list - NO GOOD
>
> 2.) User objects use key names of the form '<pl_type_id>:<pl_user_id>'
> or something similar. then we can form the key from the provided info
> and fetch based on keys. we never used to do this because sql sucked
> at finding strings - not sure how app engine does..? - BETTER..?

This is your best option. Datastore gets are a _lot_ faster than
datastore queries, and you can fetch multiple IDs in the same
operation.

-Nick Johnson

>
> 3.) is there a way to specify the id on a newly created Model? we know
> the pl_user_id is unique. we can then have a Model for each network
> and build keys from the pl_user_id. this is how we used to roll in the
> mysql world. - MAYBE..?
>
> additional ideas and feedback appreciated, thanks in advance.
> >
>



-- 
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration
Number: 368047

--~--~---------~--~----~------------~-------~--~----~
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