开发者

Which one is better to use when fetching from the datastore: key or id?

开发者 https://www.devze.com 2023-01-24 09:19 出处:网络
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开发者_JAV

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消