]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix relationship.order_by typing
authorBryan Forbes <bryan@reigndropsfall.net>
Tue, 15 Nov 2022 14:03:24 +0000 (09:03 -0500)
committersqla-tester <sqla-tester@sqlalchemy.org>
Tue, 15 Nov 2022 14:03:25 +0000 (09:03 -0500)
Fixes: #8776
### Checklist

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

Closes: #8779
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8779
Pull-request-sha: 2bc64555a1ab662881fdfd1caaabd9d21fbdf531

Change-Id: I52fe6db5ba954a6039836b45f0e89ad96049df03

doc/build/changelog/unreleased_20/8776.rst [new file with mode: 0644]
lib/sqlalchemy/orm/relationships.py

diff --git a/doc/build/changelog/unreleased_20/8776.rst b/doc/build/changelog/unreleased_20/8776.rst
new file mode 100644 (file)
index 0000000..fa4156e
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, orm
+    :tickets: 8776
+
+    Fixed issue where passing a callbale function returning an iterable
+    of column elements to :paramref:`_orm.relationship.order_by` was
+    flagged as an error in type checkers.
index e0922a5380f7a3ae90990726bdb5a9b8ef6be740..986093e02533e80c0dd9a385fb5dbf589712e0e9 100644 (file)
@@ -164,6 +164,7 @@ _ORMOrderByArgument = Union[
     Literal[False],
     str,
     _ColumnExpressionArgument[Any],
+    Callable[[], Iterable[ColumnElement[Any]]],
     Iterable[Union[str, _ColumnExpressionArgument[Any]]],
 ]
 _ORMBackrefArgument = Union[str, Tuple[str, Dict[str, Any]]]