Using sub filters/queries in Google App Engine

Posted by fredrik on Stack Overflow See other posts from Stack Overflow or by fredrik
Published on 2010-02-10T13:50:51Z Indexed on 2010/04/24 16:03 UTC
Read the original article Hit count: 387

Filed under:
|

Hi,

I'm trying to use figure out how to sub query a query that uses a filter. From what I've figured out so far while using .filter() it changes the original query, that leads to a second .filter() would also have to match the first filter.

I would like to make something like this:

modules = data.Modules.all().filter('page = ', page.key())
modules.filter('name = ', 'Test')
modules.filter('name = ', 'Test2')

I can't get the "Test2" filter to work. The only solution I have at the moment is to make all new queries.

data.Modules.all().filter('page = ', page.key()).filter('name = ', "Test").get()
data.Modules.all().filter('page = ', page.key()).filter('name = ', "Test2").get()

Or write the same as an GQL. But for me it seams quite stupid way to go.

I've looked at using ancestors, but I don't quite understand it and honestly don't know if that's the way to go.

Any ideas?

..fredrik

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about python