How to avoid returning of None values with GAE NDB

2019-09-06 18:25发布

I have complex NDB query like below:

employees = Employee.query(query.OR(Employee.passport_id == passport_id,
   Employee.inn == inn,
   query.AND(Employee.last_name == last_name,
    Employee.region == region,
    Employee.prof_area == prof_area),
   query.AND(Employee.last_name == last_name,
    Employee.first_name == first_name,
    Employee.date_of_birth == date_of_birth)
   ))

Currently when database value is None and my value is None, such entity is returned. How can I avoid that? I think I can do something like (for each field):

if inn is None:
    inn = 'something-I-do-not-expect-in-database'

But it doesn't look very good.

0条回答
登录 后发表回答