jck
jck

Reputation: 2058

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

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

Upvotes: 0

Views: 338

Answers (1)

Y.H Wong
Y.H Wong

Reputation: 7244

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

Upvotes: 1

Related Questions