mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Documentation for NotFoundError
This commit is contained in:
parent
8f19bbed02
commit
43f1c6ab4e
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
===============
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue