Google engine or request for application (python)

Can someone share your approach to executing a "or" request in an application?

Say I have

class A_db_model(db.Model): valueA = db.ListProperty(basestring) 

in valueA I

 aaa aaa, bbb bbb ccc 

I would like to return a result if valueA matches 'aaa' or 'bbb' and returns a non-duplicated result.

+4
source share
2 answers

Try it?

 A_db_model.all().filter('valueA IN', ['aaa', 'bbb']) 

or equivalent GQL:

 GqlQuery('SELECT * FROM A_db_model WHERE valueA IN :1', ['aaa', 'bbb']) 
+6
source

The two main problems with @Amber's approach are that it is slow because it basically runs a query for each value behind the curtains and it displays 30 values ​​for the query. I just wrote a blog post about this issue. This explains the best scalable way to basically execute an OR query with the application engine. You can use a separate object to make this happen. See the message for details.

http://tornblue.com/post/11310830291/app-engine-how-to-do-an-efficient-or-query

+2
source

All Articles