On Mon, Aug 10, 2009 at 6:09 PM, Ste<[email protected]> wrote:
>
> Hi,
>
> I'm a total newbie to App Engine, and to web apps in general, with a
> background in front end web design.
>
> Anyway, I've worked through the (python) "Getting Started" guide, and
> it makes sense. Now I'm trying to change small bits and pieces to
> better my understanding.
>
> For instance, I'm now using a descriptive primary key for the
> datastore by providing a user-submitted "Key Name":
>
>        greeting = Greeting(key_name="%s" % self.request.get('ID'))
>
> This works fine.
>
> However, I'm at a loss as to how to get a row back out of the
> datastore by using its Key Name. What variable should I include in my
> GQL, or am I missing the point?

When you know the key you want to retrieve a record by, you don't need
to use a query. Simply do MyModel.get_by_key_name(somename).
Alternately, you can construct Key objects using
Key.from_path("modelname", "keyname") and fetch them using db.get() or
MyModel.get().

-Nick Johnson

>
> Many thanks, and excuse my ignorance,
> Stephen
>
> >
>



-- 
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 [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