Which one is better to use when fetching from the datastore: key or id?
My mind is still impregnated with SQL thoughts... i'm used to retrieve from the database using the id as the main key, but in App Engine i'm unsure whether i should favor one over the othe开发者_JAVA百科r. What is recommended?
If you are talking about the App Engine generated id, it is effectively the same as using the key. A key is just an encoded version of the kind, namespace, and id or name.
Model.get_by_id simply converts the id to a key before fetching the entity.
精彩评论