mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Added table.delete(pk) method, refs #62
This commit is contained in:
parent
eb39c84a8f
commit
19073d6d97
3 changed files with 39 additions and 0 deletions
|
|
@ -382,6 +382,20 @@ You can cause any missing columns to be added automatically using ``alter=True``
|
|||
|
||||
>>> db["dogs"].update(1, {"breed": "Mutt"}, alter=True)
|
||||
|
||||
.. _python_api_delete:
|
||||
|
||||
Deleting a specific record
|
||||
==========================
|
||||
|
||||
You can delete a record using ``table.delete()``::
|
||||
|
||||
>>> db = sqlite_utils.Database("dogs.db")
|
||||
>>> db["dogs"].delete(1)
|
||||
|
||||
The ``delete()`` method takes the primary key of the record. This can be a tuple of values if the row has a compound primary key::
|
||||
|
||||
>>> db["compound_dogs"].delete((5, 3))
|
||||
|
||||
Upserting data
|
||||
==============
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue