Exceptions on delete in pysqlite

Wildemar Wildenburger lasses_weil at klapptsowieso.net
Fri Jan 25 19:12:57 EST 2008


Hi there,

Using pysqlite, I'd like to check if some dataset that I removed has 
been in the database at all. Ideally I'd like pysqlite to raise an 
Exception if deleting does nothing. Is that possible?

Codewise, I'd like the following, but without me checking for and 
raising the exception myself:

cur = con.execute("""DELETE FROM SomeTable WHERE id=? AND name=?""",
                      (ID, NAME))
if cur.rowcount == 0:
     raise Exception


/W



More information about the Python-list mailing list