diff options
Diffstat (limited to 'doc/build/orm/tutorial.rst')
-rw-r--r-- | doc/build/orm/tutorial.rst | 7 |
1 files changed, 6 insertions, 1 deletions
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: |