Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'seen,': 0.09; 'adapter': 0.16; 'fits': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'select.': 0.16; 'command': 0.22; 'select': 0.22; 'reset': 0.22; 'preferences': 0.24; 'tend': 0.24; 'url:home': 0.24; 'earlier': 0.24; 'task': 0.26; 'header:X -Complaints-To:1': 0.27; 'database,': 0.30; 'statement': 0.30; 'operations.': 0.31; 'stuff': 0.32; 'another': 0.32; 'fri,': 0.33; 'guess': 0.33; 'not.': 0.33; 'comment': 0.34; 'anywhere': 0.35; 'connection': 0.35; 'skip:u 20': 0.35; 'transaction': 0.35; 'operations': 0.35; 'but': 0.35; 'there': 0.35; '+0200,': 0.36; 'accessing': 0.36; 'scheme': 0.36; 'skip:> 10': 0.36; 'charset:us- ascii': 0.36; 'two': 0.37; 'starting': 0.37; 'nov': 0.38; 'to:addr :python-list': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'engines': 0.60; 'first': 0.61; 'different': 0.65; 'between': 0.67; 'started.': 0.68; 'behavior': 0.77; 'gap': 0.84; 'prefers': 0.84; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Db transactions and locking Date: Fri, 28 Nov 2014 12:28:45 -0500 Organization: IISS Elusive Unicorn References: <4loe7at2ls7tfq0oe041ru9svvsm8aksik@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-73-118-169.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417195728 news.xs4all.nl 2940 [2001:888:2000:d::a6]:52807 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81696 On Fri, 28 Nov 2014 08:57:07 +0200, "Frank Millman" declaimed the following: > >My guess now is that the connection is in one of two states - a transaction >is active, or it is not. If a command is issued, and a transaction is not >active, then a transaction is started. If a conn.commit() or a >conn.rollback() is issued, the command is passed up to the database, and the >connection state is reset to not active. > Though you may find some adapters have fits working the DB-API preferences into the engines preference... I think SQLite3 is one of those -- given its multilayer locking scheme it prefers to treat pure SELECT operations as "outside of transaction", starting a transaction on UPDATE/INSERT/DELETE operations. An adapter to a different engine might start a transaction on the first SELECT. Which is why I tend to stuff in con.commit() calls anywhere that there may be a gap of time between even two SELECT operations -- ensures nothing might block another task from accessing the database. {BTW: my earlier comment was not about the behavior seen, but about the statement of not seeing anything about it in the documentation} -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/