python - How to create a datastore_query.Order object for ndb Query constructor? -
i noticed @ https://developers.google.com/appengine/docs/python/ndb/queryclass, there optional argument ndb.query constructor allows specify order in query. argument must of type datastore_query.order, can't seem find documentation on object or how create it. specify list of model properties order by:
property_list = [item.property1, item.property2] items = item.query(orders=order(property_list))
instead of:
items = item.query().order(item.property1, item.property2)
any ideas?
i think you're looking datastore_query.compositeorder
composed of propertyorder
s of properties in list. source order subclasses seems explained quite well, , can take @ ndb.query.order() construct them, , object pass constructor.
(i can't think of situation using .order() wouldn't suitable though, , simpler.)
Comments
Post a Comment