why not db.Model.get_by_key_name.

 
http://code.google.com/appengine/docs/python/datastore/modelclass.html#Model_get_by_key_name

T

On Sep 3, 4:13 am, Paweł Gronkiewicz <[email protected]> wrote:
> While we are at it, how do you query a key by it's name? I pretty much
> need to check if entity exists for a given key name.
>
> GQL documentation lacks examples and is really lacking, especially for
> people with less experience.
>
> On Sep 2, 8:48 pm, "Ikai L (Google)" <[email protected]> wrote:
>
>
>
>
>
>
>
> > 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 <[email protected]> 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 [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-appengine%2Bunsubscrib
> > >  [email protected]>
> > > .
> > > 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to