Reading: http://code.google.com/appengine/docs/python/datastore/gqlreference.html
I want to use:
: = IN
but I'm not sure how to make it work. Let's pretend that
class User(db.Model):
name = db.StringProperty()
class UniqueListOfSavedItems(db.Model):
str = db.StringPropery()
datesaved = db.DateTimeProperty()
class UserListOfSavedItems(db.Model):
name = db.ReferenceProperty(User, collection='user')
str = db.ReferenceProperty(UniqueListOfSavedItems, collection='itemlist')
How can I execute a query that gets me a list of saved items for a user? Obviously I can do:
q = db.Gql("SELECT * FROM UserListOfSavedItems WHERE name :=", user[0].name)
but it gives me a list of keys. I now want to take this list and get it in the query to get the str field from UniqueListOfSavedItems. I thought I could do:
q2 = db.Gql("SELECT * FROM UniqueListOfSavedItems WHERE := str in q")
but something is wrong ... any ideas? This (I am at work, so I can not check it now):
q2 = db.Gql("SELECT * FROM UniqueListOfSavedItems __key__ := str in q)
side of the note: what a devilishly difficult problem to find, because all I really care about is the IN operator.