diff --git a/docs/python-api.rst b/docs/python-api.rst index 878752a..1b2a2c5 100644 --- a/docs/python-api.rst +++ b/docs/python-api.rst @@ -122,6 +122,17 @@ If the table has a compound primary key you can pass in the primary key values a >>> db["compound_dogs"].get(("mixed", 3)) +If the record does not exist a ``NotFoundError`` will be raised: + +.. code-block:: python + + from sqlite_utils.db import NotFoundError + + try: + row = db["dogs"].get(5) + except NotFoundError: + print("Dog not found") + Creating tables ===============