Reputation: 17617
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
Upvotes: 1
Views: 363
Reputation: 90017
It appears that what you're trying to do is an OR query, which isn't supported in App Engine. You can use an IN query, which simulates this by doing multiple queries for you.
The reason the first thing you tried doesn't work is that you're trying to filter your query so that your results match both "Test" and "Test2", which obviously will never be true for a non-list property.
Upvotes: 3