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

Jon Ribbens jon+usenet at unequivocal.eu
Tue May 30 11:03:59 EDT 2017


On 2017-05-30, Joseph L. Casale <jcasale at activenetwerx.com> wrote:
>> 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?

Well, as you can see, it rollbacks then commits, so the commit does nothing.



More information about the Python-list mailing list