[google-appengine] Datastore viewer query by key.

2010-09-02 Thread John Gardner
This is probably obvious, but:
I cannot for the life of me figure out how to fetch a known entity by
key in the viewer.

The GQL reference doesn't specify key syntax, since you can do a
db.get(key) from code.

I've tried:
SELECT * FROM entity where __key__ = "string-key"
SELECT * FROM entity where entity.__key__ = "string-key"
SELECT * FROM entity where entity.key = "string-key"
SELECT * FROM entity where entity = "string-key"
and the same without quotes.

This really should be easier, I think.

-- 
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-appeng...@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.



Re: [google-appengine] Datastore viewer query by key.

2010-09-02 Thread Ikai L (Google)
Try this:

SELECT * FROM entity where __key__ = KEY('string-key')

See the section about Keys here:

http://code.google.com/appengine/docs/python/datastore/gqlreference.html

On Thu, Sep 2, 2010 at 10:28 AM, John Gardner  wrote:

> This is probably obvious, but:
> I cannot for the life of me figure out how to fetch a known entity by
> key in the viewer.
>
> The GQL reference doesn't specify key syntax, since you can do a
> db.get(key) from code.
>
> I've tried:
> SELECT * FROM entity where __key__ = "string-key"
> SELECT * FROM entity where entity.__key__ = "string-key"
> SELECT * FROM entity where entity.key = "string-key"
> SELECT * FROM entity where entity = "string-key"
> and the same without quotes.
>
> This really should be easier, I think.
>
> --
> 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-appeng...@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.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
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-appeng...@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.