hey nick - met you at I/O in may, foulplay media, social gaming and all that... still think you should get on facebook ;)
yes, i believe that #3 would be the best solution, let me be more specific: i'm under the impression that the app engine allows you to specify a string identifier for a model (key_name) OR allow the datastore to issue it's own numeric identifier (id). what i want to do is set the numeric identifier instead of letting the datastore create one. i have a unique 64bit integer that identifies the user from the social network, i would like to use that as the numeric key if possible (should be faster, avoid casting). can i do this? otherwise, as tmdk mentioned, i could use key_name and stick a letter in front of it, like 'L12345' for platform user id 12345. On Jul 10, 7:23 am, "Nick Johnson (Google)" <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
