]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix `get_one` return value description
authorJochen Kupperschmidt <homework@nwsnet.de>
Sat, 14 Oct 2023 19:08:57 +0000 (15:08 -0400)
committersqla-tester <sqla-tester@sqlalchemy.org>
Sat, 14 Oct 2023 19:08:58 +0000 (15:08 -0400)
<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
<!-- Describe your changes in detail -->

The `get_one()` method is described as raising an error if no row is found instead of returning `None` (as `get()` does). Also, the return type hint prohibits `None`.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)
-->

This pull request is:

- [x] A documentation / typographical / small typing error fix
- Good to go, no issue or tests are needed
- [ ] 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.

**Have a nice day!**

Closes: #10473
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10473
Pull-request-sha: 1cd2c2a2df2c91a303e459c8f0c5dc950d8c7b39

Change-Id: Iaf69b05d99f4ed0df922f34f27be0b46c1410f7e

lib/sqlalchemy/orm/scoping.py
lib/sqlalchemy/orm/session.py

index c03cfe8d54b99d2638813c8daafbb3c5d21a5a9f..e8dfb8a80a5d36f7c7617c08bcdf11c2354f10bd 100644 (file)
@@ -1099,7 +1099,7 @@ class scoped_session(Generic[_S]):
 
         .. versionadded:: 2.0.22
 
-        :return: The object instance, or ``None``.
+        :return: The object instance.
 
         .. seealso::
 
index e1d2c4947b85fe732954fb9e61123892e94e2083..e247e0d143fd2869604e09c9d00dafc1d53ff40e 100644 (file)
@@ -3683,7 +3683,7 @@ class Session(_SessionClassMethods, EventTarget):
 
         .. versionadded:: 2.0.22
 
-        :return: The object instance, or ``None``.
+        :return: The object instance.
 
         .. seealso::