Python DB API - commit() v. execute("commit transaction")?

Joseph L. Casale jcasale at activenetwerx.com
Tue May 30 10:19:21 EDT 2017


-----Original Message-----
From: Python-list [mailto:python-list-
bounces+jcasale=activenetwerx.com at python.org] On Behalf Of Ian Kelly
Sent: Tuesday, May 30, 2017 8:12 AM
To: Python <python-list at python.org>
Subject: Re: Python DB API - commit() v. execute("commit transaction")?

> There's no difference I'm aware of in the implementations I've used,
> but having a consistent API does allow for constructions such as:
> 
> try:
>     do_stuff(conn)
> except:
>     conn.rollback()
> finally:
>     conn.commit()

So you always commit even after an exception?



More information about the Python-list mailing list