Reputation:
I'm writing a Python app on Google App Engine and I need to have an ndb query but the problem is that the query can be on different class types so I'm looking for a method other than clss.Query()
. I need clss
to be a variable. Also could I possibly use a filter with that?
Upvotes: 2
Views: 221
Reputation: 2537
There is in fact a way to do this that is mentioned in the documentation:
from google.appengine.ext import ndb
ndb.Query(kind=clss)
You could also use filters, either by passing the filter as a parameter in the query:
ndb.Query(kind=clss, filters=...)
or by applying a filter()
on the query like you would usually do:
ndb.Query(kind=clss).filter()
Upvotes: 2