summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/selectable.py
diff options
context:
space:
mode:
authorEitan Mosenkis <eitan@mosenkis.net>2022-11-14 23:11:15 +0200
committerGitHub <noreply@github.com>2022-11-14 22:11:15 +0100
commit9237bf15e612ba82555444751bd69dc2a831e7f4 (patch)
treea0db20b19644f50b6f6075fee7ed87d236a635ec /lib/sqlalchemy/sql/selectable.py
parenteea0f44bbdb759368996dcdb241e837c7c809fb9 (diff)
downloadsqlalchemy-9237bf15e612ba82555444751bd69dc2a831e7f4.tar.gz
Explicitly state what happens if `order_by` is called more than once. (#8791)
* Explicitly state what happens if `order_by` is called more than once. The existing docs cover how to clear existing `order_by` clauses but don't actually describe the behavior of calling `order_by` multiple times with different clauses. * Also update Select.order_by.
Diffstat (limited to 'lib/sqlalchemy/sql/selectable.py')
-rw-r--r--lib/sqlalchemy/sql/selectable.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index 488dfe721..23260a985 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -4096,9 +4096,10 @@ class GenerativeSelect(SelectBase, Generative):
stmt = select(table).order_by(table.c.id, table.c.name)
- All existing ORDER BY criteria may be cancelled by passing
- ``None`` by itself. New ORDER BY criteria may then be added by
- invoking :meth:`_sql.Select.order_by` again, e.g.::
+ Calling this method multiple times is equivalent to calling it once
+ with all the clauses concatenated. All existing ORDER BY criteria may
+ be cancelled by passing ``None`` by itself. New ORDER BY criteria may
+ then be added by invoking :meth:`_orm.Query.order_by` again, e.g.::
# will erase all ORDER BY and ORDER BY new_col alone
stmt = stmt.order_by(None).order_by(new_col)