Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81668
| References | <m56u4s$baa$1@ger.gmane.org> <4loe7at2ls7tfq0oe041ru9svvsm8aksik@4ax.com> <m5924d$nbq$1@ger.gmane.org> |
|---|---|
| Date | 2014-11-28 16:54 +1100 |
| Subject | Re: Db transactions and locking |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16395.1417154102.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Db transactions and locking Chris Angelico <rosuav@gmail.com> - 2014-11-28 16:54 +1100
csiph-web