On 2017-05-30, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> On Tue, 30 May 2017 13:42:14 -0000 (UTC), Jon Ribbens
><jon+use...@unequivocal.eu> declaimed the following:
>>On 2017-05-30, Skip Montanaro <skip.montan...@gmail.com> wrote:
>>> Assuming the underlying database supports transactions, is there any
>>> difference between calling the commit() method on the connection and
>>> calling the execute method on the cursor with the "commit transaction"
>>> statement? It seems a bit asymmetric to me to start a transaction with
>>>
>>>   cur.execute("begin transaction")
>>>
>>> but end it with
>>>
>>>   conn.commit()
>>
>>Yes, I found this most peculiar.
>
> https://stackoverflow.com/questions/2546926/why-connection-in-pythons-db-api-does-not-have-begin-operation
>
> may offer some reasoning...  (along with its linked discussion
> https://groups.google.com/forum/#!topic/comp.lang.python/gNC_O6zUdAA )

I can't make head nor tail of what they are trying to say there.
Mind you, it doesn't help that the DB-API concept of cursors seems
to bear almost no resemblance to the SQL concept of cursors.

>       The main argument I have for not using
>               cur.execute("begin transaction") 
> is that the DB-API module concept of being in/out of a transaction might
> get out of synchronization.

What would you suggest doing instead?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to