我有如下复杂的 NDB 查询:
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)
))
当前,当数据库值为None
且我的值为时None
,将返回此类实体。我怎样才能避免这种情况?我想我可以做类似的事情(对于每个领域):
if inn is None:
inn = 'something-I-do-not-expect-in-database'
但它看起来不是很好。