mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54: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
|
|
@ -864,6 +864,14 @@ class Table(Queryable):
|
|||
with self.db.conn:
|
||||
self.db.conn.execute(sql, pk_values)
|
||||
|
||||
def delete_where(self, where=None, where_args=None):
|
||||
if not self.exists:
|
||||
return []
|
||||
sql = "delete from [{}]".format(self.name)
|
||||
if where is not None:
|
||||
sql += " where " + where
|
||||
self.db.conn.execute(sql, where_args or [])
|
||||
|
||||
def update(self, pk_values, updates=None, alter=False):
|
||||
updates = updates or {}
|
||||
if not isinstance(pk_values, (list, tuple)):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue