sqlite3 with context manager

Tim Arnold Tim.Arnold at sas.com
Fri Sep 2 14:43:53 EDT 2011


Hi,
I'm using the 'with' context manager for a sqlite3 connection:

with sqlite3.connect(my.database,timeout=10) as conn:
             conn.execute('update config_build set datetime=?,result=?
where id=?',
                               (datetime.datetime.now(), success,
self.b['id']))

my question is what happens if the update fails? Shouldn't it throw an
exception?

I ask because apparently something went wrong yesterday and the code
never updated but I never got any warning.  I rebooted the machine and
everything is okay now, but I'd like to understand what happened.

thanks,
--Tim



More information about the Python-list mailing list