entity groups - Google Appengine: Odd get_by_key_name behavior -
Update: After further testing, it seems that this problem affects all child organizations in my unit group. For all these different instances, my original parent is the user type, which is my own creation, not in the built user type. After removing the parent = user from the child's constructor, the received_by_name works as expected, however, I would like to be able to use the unit group's functionality with defined key, if possible.
- Hello, I'm trying to use the defined key names for fast inquiries in my GAE project.
However, I have participated in a strange problem where I can not bring them the key. This code does not seem to work:
some notes:
- I only tested in SDK
-
l.key (). Name () key gives the string listed with the unit when I see it in the data store. I can copy and paste the string from the story of the data and use it as RG for get_by_key_name () and it does not work either.
-
All names for the login type are "L" (i.e. lowercase "L") with prefixels and all other lowercase and underscores or dashes but may be less than 500 bytes .
-
Other types of this type
- The key is the interpolation of the property of the login type, and I can fix the object regularly. Filtered () methods
- "parent" is a user class for example (to mention that the way I am fetched has some effect on it)
So I have to ask, is there any obvious reason why this will not work? Any known issues with key name searches using SDK?
Your second comment is correct, AFAIK parent / child relationship A directory or folder in your file system The structure is similar to your key (perceptual) / parent / [parent_name] / login / [login_name]
. So if you try to bring / loginins / [login_keyname]
you will not get your unit. (There is no rule that all login
s must be the origin of the parent
s; get_by_key_name (), should be reported every time in relation to parents .)
In my own code, I have made my keys with key.from_path ()
. I use class methods, e.g. Login.key_for_name (some_parent, some_name)
and login.get_by_key_name_for_parent (some_parent, some_name)
(well, my method's name is small, but it's still clarifying it It is not possible for me to generate a key with the wrong parent / child relationship.
Comments
Post a Comment