[google-appengine] Re: Using data viewer to query by key
Hi Bemmu, On Mon, Aug 10, 2009 at 3:39 PM, Bemmubemmu@gmail.com wrote: If I just know a key, how do I query by that in the admin console data viewer? My keys are people, so if I get complaints about mistakes in user data, it would be convenient to pull up that user's data by key. I've tried doing the following: SELECT * FROM User WHERE __key__ = 'myspace.com:472071387' Result is that I get a page that says Server Error - A server error has occurred. I also tried SELECT * FROM User WHERE __key__ = KEY('myspace.com:472071387') And got same error. Finally I tried SELECT * FROM User WHERE __key__ = KEY(myspace.com:472071387) And this time I got complaint of invalid GQL query. So how should I be doing this query or is it even possible? None of these are keys - they are only key _names_. A key consists of a type as well as a name or ID (and possibly the type name/id pairs of parent entities). In your case, you want to do something like this: SELECT * FROM User WHERE __key__ = KEY('User', 'myspace.com:472071387') -Nick Johnson -- Nick Johnson, Developer Programs Engineer, App Engine --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Using data viewer to query by key
Thank you. Mental model adjusted. On Aug 10, 6:02 pm, Nick Johnson (Google) nick.john...@google.com wrote: Hi Bemmu, On Mon, Aug 10, 2009 at 3:39 PM, Bemmubemmu@gmail.com wrote: If I just know a key, how do I query by that in the admin console data viewer? My keys are people, so if I get complaints about mistakes in user data, it would be convenient to pull up that user's data by key. I've tried doing the following: SELECT * FROM User WHERE __key__ = 'myspace.com:472071387' Result is that I get a page that says Server Error - A server error has occurred. I also tried SELECT * FROM User WHERE __key__ = KEY('myspace.com:472071387') And got same error. Finally I tried SELECT * FROM User WHERE __key__ = KEY(myspace.com:472071387) And this time I got complaint of invalid GQL query. So how should I be doing this query or is it even possible? None of these are keys - they are only key _names_. A key consists of a type as well as a name or ID (and possibly the type name/id pairs of parent entities). In your case, you want to do something like this: SELECT * FROM User WHERE __key__ = KEY('User', 'myspace.com:472071387') -Nick Johnson -- Nick Johnson, Developer Programs Engineer, App Engine --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---