SQLAlchemy的group_by和order_by的区别

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

2、http://www.w3school.com.cn/sql/sql_groupby.asp

posted @ 2017-12-29 11:04  脚本小娃子  阅读(3563)  评论(2编辑  收藏  举报