[google-appengine] Re: GQL Query involving key string
thanks bryan & bill! yes, I was using GQL because I wanted to query via the data viewer. the KEY('mykeystring') on the right-hand side not working was throwing me off. that's good to know that it works in the shell. audrey On Feb 27, 11:49 am, Bill wrote: > Audrey, > > If for some reason, you need to use GQL to lookup by key string > instead of using get() like Bryan suggested, you can use KEY > ('mykeystring') instead of the raw string on the right-hand side of > your __key__ comparison. Full documentation is > here:http://code.google.com/appengine/docs/python/datastore/gqlreference.html > > While the above works in code and the shell, it doesn't seem to work > in the Data Viewer. I have entered an issue for this > here:http://code.google.com/p/googleappengine/issues/detail?id=1105 > > -Bill > > On Feb 26, 6:21 pm,AudreyM Roy wrote: > > > How do I write a GQL query that's something like this... > > > SELECT * FROM Pet WHERE __key__='mykeystring' > > > the above returns the error BadFilterError: invalid filter: __key__ > > filter value must be a Key; received mykeystring (a unicode). > > >Audrey --~--~-~--~~~---~--~~ 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: GQL Query involving key string
Audrey, If for some reason, you need to use GQL to lookup by key string instead of using get() like Bryan suggested, you can use KEY ('mykeystring') instead of the raw string on the right-hand side of your __key__ comparison. Full documentation is here: http://code.google.com/appengine/docs/python/datastore/gqlreference.html While the above works in code and the shell, it doesn't seem to work in the Data Viewer. I have entered an issue for this here: http://code.google.com/p/googleappengine/issues/detail?id=1105 -Bill On Feb 26, 6:21 pm, Audrey M Roy wrote: > How do I write a GQL query that's something like this... > > SELECT * FROM Pet WHERE __key__='mykeystring' > > the above returns the error BadFilterError: invalid filter: __key__ > filter value must be a Key; received mykeystring (a unicode). > > Audrey --~--~-~--~~~---~--~~ 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: GQL Query involving key string
You don't actually need to use GQL, just use: db.get('mykeystring') On Feb 26, 9:21 pm, Audrey M Roy wrote: > How do I write a GQL query that's something like this... > > SELECT * FROM Pet WHERE __key__='mykeystring' > > the above returns the error BadFilterError: invalid filter: __key__ > filter value must be a Key; received mykeystring (a unicode). > > Audrey --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---