gql - Google App Engine null sort order -
according googles documentation, null values have no sort order. there way configure behavior. instance, if sorting integer property in ascending order, can configure datastore return null values last or first?
your best bet may save property blank "" string each entity has null value property. sure run put() on each entity alter.
employees = employee.all().fetch(50) employee in employees: if employee.hobbies none: # null value property employee.hobbies = "" employee.put()
of course, not efficient way perform task. may want create list object, "batch_put_list," , append each employee object list. then, perform db.put(batch_put_list).
batch_put_list = [] employees = employee.all().fetch(50) employee in employees: if employee.hobbies none: employee.hobbies = "" batch_put_list.append(employee) db.put(batch_put_list)
hope helps.
Comments
Post a Comment