How to avoid returning of None values with GAE NDB?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 04:08:36

问题


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.

来源:https://stackoverflow.com/questions/11316077/how-to-avoid-returning-of-none-values-with-gae-ndb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!