Does get(key) require the entity key and get_by_key_name(key_names) require the key_name?
views:
485answers:
2
A:
Here is official explanation for get() and this one is for get_by_key_name() I hope this helps.
Maksim
2009-07-12 22:41:25
Thanks! I'll take a look.
ehfeng
2009-07-12 22:44:07
yeah, I've actually read over those documentations...I was pretty sure that "key" and "key name" were two separate things, but wanted to be sure. So...are they different?
ehfeng
2009-07-12 22:46:24
+4
A:
There is a difference. An Entity in the datastore is identified by a combination of its Kind, its parent, and its identifier. (link) The "identifier" can either be a number or a string. A Key object contains both the identifier and the parent information. So when you call get(), there is just one argument - the Key object. When you call get_by_key_name, notice that there are 2 arguments - one is the key_name, one is the parent.
So a Key is an object with several parts, whereas a key name is just a string. To make things more confusing, a Key object can be encoded as a string.
Peter Recore
2009-07-12 23:23:13