码迷,mamicode.com
首页 > 数据库 > 详细

SQLAlchemy的group_by和order_by的区别

时间:2017-12-29 15:23:27      阅读:413      评论:0      收藏:0      [点我收藏+]

标签:log   esc   setting   native   exist   cell   doc   apply   order   

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

SQLAlchemy的group_by和order_by的区别

标签:log   esc   setting   native   exist   cell   doc   apply   order   

原文地址:https://www.cnblogs.com/shengulong/p/8143440.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!