Suppose 开发者_开发百科I have a table with the Column A and B.
I want to find out whether a particular field exists in Column A. I also want to know how many of them are there
Suppose you have a Model that looks like this:
class Employee(db.Model):
name = db.StringProperty()
You can query the existence of a particular value and/or the total number of entities which have that value in a property, you can query like so:
def jack_chan_in_employee():
query = Employee.all()
count = query.filter('name =', 'Jacky Chan').count()
return count
精彩评论