Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81668 > unrolled thread

Re: Db transactions and locking

Started byChris Angelico <rosuav@gmail.com>
First post2014-11-28 16:54 +1100
Last post2014-11-28 16:54 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Db transactions and locking Chris Angelico <rosuav@gmail.com> - 2014-11-28 16:54 +1100

#81668 — Re: Db transactions and locking

FromChris Angelico <rosuav@gmail.com>
Date2014-11-28 16:54 +1100
SubjectRe: Db transactions and locking
Message-ID<mailman.16395.1417154102.18130.python-list@python.org>
On Fri, Nov 28, 2014 at 4:44 PM, Frank Millman <frank@chagford.com> wrote:
> There seems to be a difference between conn.commit() and
> cur.execute('commit'), which leaves the connection in a different state.

Yes, if a connection library offers a way to commit/roll back, it's
usually best to use that.

> However, for my purposes, this is academic.
>
> The main lesson I have learned is that you should always issue a commit
> after any logical set of SQL statements, even if they are only SELECTs,
> otherwise the locks are not released.

Correct. Every time you use any database, you should think in terms of
units of work, which correspond precisely to transactions.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web