开发者

How can I check if a particular value exists in a particular column in google app engine datastore?(python)

开发者 https://www.devze.com 2023-02-17 17:40 出处:网络
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 thereSuppose you have a Model

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
0

精彩评论

暂无评论...
验证码 换一张
取 消