hi jen,
apologies that i didn't explain Band.gql('') when i made my earlier
post.
that's pretty much of a "SELECT *" as you found out.
now, i'm not sure how you're storing your objects, but perhaps the IDs
are not the same as what you're expecting (i.e., 1, 2, etc.). would it
be
possible for you to post your model (or at least part of it) so we can
see
what you have?
can you also provide the code you're using to put your objects into
the
datastore with?
the reason why i'm asking is because a default "ID" that App Engine
assigns is always going to be unique and auto-incrementing. you have
the option of giving a key_name instead of taking the default, so if
you
don't specifically specify the IDs, then they're auto-generated for
you.
finally, if you wish for me to take a look at your application, please
provide your application ID (usually APP_ID.appspot.com) or whatever
you put after "application: " in your app.yaml file.
thanks!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
http://corepython.com
wesley.j.chun :: [email protected]
developer relations :: google app engine
On Jan 3, 10:00 pm, "Ms. Jen" <[email protected]> wrote:
> Ok, the results of an evening spent reading docs, searching for
> answers, and otherwise beating my head against the GAE wall, is the
> following:
>
> If I pass the band name (band.band_name) on the URL, I am able to
> search for it in the datastore with:
>
> band_edit = Band.gql("WHERE band_name = 'id'")
>
> And the page is rendered with just the band in question and not a
> whole list of them. Well, that was easy. So, why don't I use it?
> Because people can have several bands of the same name or misspell the
> name or the like, and a unique ID as the entity ID would be much more
> useful and accurate over time.
>
> But if I try with the ID or Key, I have no luck. If I pass the ID as
> band_id and then put it to the database as another string or integer
> entity named band_id, and then try and search the datastore as above:
>
> band_edit = Band.gql("WHERE band_id = 'id'")
>
> I have no luck. None. (Yes, None with a big N). Either I get a
> blank page or I am told that it can't iterate Band or there is an
> integer or string error.
>
> According
> to:http://code.google.com/appengine/docs/python/datastore/queriesandinde...
> there are limited queries on Keys and IDs allowed.
>
> I know that folks can do it, as I have seen GAE python based apps that
> call individual entities by a URL id. Yes, the docs say you can, but
> with no concrete examples. Is there a cookbook recipe for how to get
> by ID or Key?
--
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.