summaryrefslogtreecommitdiff
path: root/doc/build
diff options
context:
space:
mode:
authorEric Siegerman <eric.siegerman@rci.rogers.com>2015-09-24 13:16:58 -0400
committerEric Siegerman <eric.siegerman@rci.rogers.com>2015-09-24 13:22:45 -0400
commita9b5fb3f497837c0a4f1122c49c5dd54c87474a0 (patch)
tree5d898b3d13afce1c73bd8bc6b2ebb1199e9f4d84 /doc/build
parent0854f82993c9bc07a64cc52bb4c092d1f5f11b8c (diff)
downloadsqlalchemy-pr/201.tar.gz
Add Query.one_or_none()pr/201
Diffstat (limited to 'doc/build')
-rw-r--r--doc/build/changelog/changelog_10.rst4
-rw-r--r--doc/build/orm/tutorial.rst7
2 files changed, 10 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst
index 09800bea8..5c5ffed1d 100644
--- a/doc/build/changelog/changelog_10.rst
+++ b/doc/build/changelog/changelog_10.rst
@@ -90,6 +90,10 @@
to again work as it is based on an 8.0.x version of Postgresql.
Fix courtesy Pete Hollobon.
+ .. change::
+ :tags: orm
+
+ Add Query.one_or_none() method.
.. changelog::
:version: 1.0.8
diff --git a/doc/build/orm/tutorial.rst b/doc/build/orm/tutorial.rst
index 6958e15d8..ed8d05534 100644
--- a/doc/build/orm/tutorial.rst
+++ b/doc/build/orm/tutorial.rst
@@ -849,7 +849,7 @@ database results. Here's a brief tour:
('%ed', 1, 0)
{stop}<User(name='ed', fullname='Ed Jones', password='f8s7ccs')>
-* :meth:`~.Query.one()`, fully fetches all rows, and if not
+* :meth:`~.Query.one()` fully fetches all rows, and if not
exactly one object identity or composite row is present in the result, raises
an error. With multiple rows found:
@@ -892,6 +892,11 @@ database results. Here's a brief tour:
web service, which may want to raise a "404 not found" when no results are found,
but raise an application error when multiple results are found.
+* :meth:`~.Query.one_or_none` is like :meth:`~.Query.one`, except that if no
+ results are found, it doesn't raise an error; it just returns ``None``. Like
+ :meth:`~.Query.one`, however, it does raise an error if multiple results are
+ found.
+
* :meth:`~.Query.scalar` invokes the :meth:`~.Query.one` method, and upon
success returns the first column of the row: