Hi Mariza,
ive been having the same issue as ARMIX,
my question is i have a page model one of the page models propertys is
a field called pics which is a list property
im storing a list ok keys from a photo model ... the idea is page has
a number of photos.
from what your saying i think ill need to loop through my list and do
a new query per list item as oposed to using the GQL IN syntax to try
and match the photo model's key with my list of keys from my page.pics
property
is that correct or is there a way to use a Kinds/Models key in GQL ?
On Aug 23, 2:55 am, "Marzia Niccolai" <[EMAIL PROTECTED]> wrote:
> Hi Armin,
> You can't query for the key, there is really no need. If you know the key
> for the entity you want just do:
>
> entity = MyModel.get(key)
>
> Thats all there is to it.
>
> -Marzia
>
> On Fri, Aug 22, 2008 at 7:43 AM, ARMIX <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm new to App Engine, new to python and have some problems with the
> > datastore. :)
> > I'd like to query a record from the Datastore where the field "user" =
> > users.get_current_user() and the field "key" =
> > "agNhd25yCgsSBE5vdGUYBww"
> > ... so the Query looks like:
> > notes = db.GqlQuery("SELECT * FROM Note WHERE user = :1 AND key = :2
> > LIMIT 1", users.get_current_user(), key)
> > ...but that doesn't work.
>
> > If I submit the same query without the "AND key = :2" it works fine.
> > It seems that it is not possible to query for the entity key? Is that
> > right? And if yes, how can I get the requested record?
>
> > Until now I tried the following queries without success:
> > notes = db.GqlQuery("SELECT * FROM Note WHERE user = :1 AND key = :2
> > LIMIT 1", users.get_current_user(), key)
> > notes = db.GqlQuery("SELECT * FROM Note WHERE user = :1 AND id = :2
> > LIMIT 1", users.get_current_user(), "7")
> > notes = db.GqlQuery("SELECT * FROM Note WHERE user = :1",
> > users.get_current_user())
> > notes = Note.get_by_key_name(key)
> > notes = Note.get(db.key.from_path('Note', key)
> > notes = Note.get_by_key_name("agNhd25yCgsSBE5vdGUYBww")
> > notes = db.get("agNhd25yCgsSBE5vdGUYBww")
>
> > Sometimes I got the following error: 'Note' object is not iterable
>
> > The class "Note":
> > class Note(db.Model):
>
> > user = db.UserProperty()
>
> > subj = db.StringProperty(multiline=False)
>
> > text = db.StringProperty(multiline=True)
>
> > tscrt = db.DateTimeProperty(auto_now_add=True)
>
> > tschg = db.DateTimeProperty(auto_now=True)
>
> > Can anybody help me please?
>
> > Thanks,
> > Armin
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---