- 1、官网解释:
group_by
(*criterion)-
apply one or more GROUP BY criterion to the query and return the newly resulting
Query
功能:去重和排序
2、官网解释:
order_by
(*criterion)
apply one or more ORDER BY criterion to the query and return the newly resulting Query
All existing ORDER BY settings can be suppressed by passing None
- this will suppress any ORDER BY configured on mappers as well.
Alternatively, an existing ORDER BY setting on the Query object can be entirely cancelled by passing False
as the value - use this before calling methods where an ORDER BY is invalid.
功能:只是排序,并不去重
参考:
1、http://docs.sqlalchemy.org/en/rel_0_9/orm/query.html