If this is an Expando model, or it is not important for you to check the property name, you can do it easily using GenericProperty:
kwargs = {'title' : 'mytitle',
'age' : 34 }
q = MyModel.query()
for kw, vals in kwargs.items():
if not isinstance(vals, (list, tuple)):
vals = (vals,)
for v in vals:
q = q.filter(ndb.GenericProperty(kw) == v)
, ( Model) , _properties,
q = q.filter(MyModel._properties[kw] == v)
getattr(), :
q = q.filter(getattr(MyModel, kw) == v)
, getattr() "Python", _properties "datastore" . , -
class MyModel(ndb.Model):
foo = StringProperty('bar')
Python foo, .