mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Added table.delete_where(), closes #62
This commit is contained in:
parent
19073d6d97
commit
169ea455fc
3 changed files with 37 additions and 0 deletions
|
|
@ -396,6 +396,17 @@ The ``delete()`` method takes the primary key of the record. This can be a tuple
|
|||
|
||||
>>> db["compound_dogs"].delete((5, 3))
|
||||
|
||||
Deleting multiple records
|
||||
=========================
|
||||
|
||||
You can delete all records in a table that match a specific WHERE statement using ``table.delete_where()``::
|
||||
|
||||
>>> db = sqlite_utils.Database("dogs.db")
|
||||
>>> # Delete every dog with age less than 3
|
||||
>>> db["dogs"].delete_where("age < ?", [3]):
|
||||
|
||||
Calling ``table.delete_where()`` with no other arguments will delete every row in the table.
|
||||
|
||||
Upserting data
|
||||
==============
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue