Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'happens.': 0.09; 'here?': 0.09; 'sure,': 0.09; 'python': 0.11; '>>': 0.16; '4:39': 0.16; 'mean,': 0.16; 're-read': 0.16; 'stuff,': 0.16; 'sure.': 0.16; 'unlikely': 0.16; 'wrote:': 0.18; 'commit': 0.19; 'starts': 0.20; 'work,': 0.20; 'email addr:gmail.com>': 0.22; 'creating': 0.23; 'specifies': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'another': 0.32; 'open': 0.33; 'fri,': 0.33; 'transaction': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'material': 0.36; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'system.': 0.39; 'how': 0.40; 'ian': 0.60; 'logs': 0.60; 'transaction.': 0.60; 'impact': 0.61; 'new': 0.61; "you're": 0.61; "you'll": 0.62; 'show': 0.63; 'statement,': 0.68; '4:26': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=m1rt2K/saUuqZuZU9bsozpvIZCVyYYueQCrcTjDLIu0=; b=cr/zqQxfjCY/33pJhYG4uSyyaTy5S/NxieLXciPYcTZUiIml5y8l5HmJnPIHVg5E6E YaWaJUP1k5n0iOCOS3S8+hqKmhdjFJ39n0d/w1dKbe79q+mil5oMUtUa+I70QhBZyCVK /cm4qQ1hLWtyfUDwukwm6cbZMPaiYatO3YvtlVOXEVZQ1+vETQ7y7t1QlzSSBJXb0YVZ ykMSzZjpY0Cx2uq6VV7nTnHp2epJRicp0H8rp4KHnt6Vab+KKaFuDFHEJTDjgMqpSUjD Y0xXY2VbsCt4Lsm2zpJwwGrMTODFkJMM2fxOTbYM6pXLpBxrkevpz7Obckt5a39aksdA F/DA== MIME-Version: 1.0 X-Received: by 10.66.252.193 with SMTP id zu1mr74187290pac.153.1417189467517; Fri, 28 Nov 2014 07:44:27 -0800 (PST) In-Reply-To: References: Date: Fri, 28 Nov 2014 08:44:27 -0700 Subject: Re: Db transactions and locking From: Ian Kelly To: Python Content-Type: multipart/alternative; boundary=047d7b15b2efca792c0508ed2237 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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417189469 news.xs4all.nl 2883 [2001:888:2000:d::a6]:46392 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81687 --047d7b15b2efca792c0508ed2237 Content-Type: text/plain; charset=UTF-8 On Nov 27, 2014 4:39 PM, "Chris Angelico" wrote: > > On Fri, Nov 28, 2014 at 5:02 AM, Ian Kelly wrote: > > On Nov 27, 2014 4:26 AM, "Frank Millman" wrote: > >> All Python database adaptors that I have used start a transaction when you > >> open a cursor. I have just re-read DB-API 2.0, and I cannot see anything > >> that specifies this behaviour, but AFAICT this is what happens. > > > > I don't know how others work, but cx_Oracle starts a transaction when you > > execute a statement, not when you open a cursor. > > Is there any material difference here? I mean, sure, you have a > transaction, it'll show up in logs and stuff, but without any locks, > it's unlikely to have much impact on the system. Unless you're > creating and destroying a bunch of unnecessary cursors all the time, > of course, but that'd be wasteful for other reasons. Sure. If you commit the transaction and then execute another statement, you'll get a new transaction. --047d7b15b2efca792c0508ed2237 Content-Type: text/html; charset=UTF-8


On Nov 27, 2014 4:39 PM, "Chris Angelico" <rosuav@gmail.com> wrote:
>
> On Fri, Nov 28, 2014 at 5:02 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> > On Nov 27, 2014 4:26 AM, "Frank Millman" <frank@chagford.com> wrote:
> >> All Python database adaptors that I have used start a transaction when you
> >> open a cursor. I have just re-read DB-API 2.0, and I cannot see anything
> >> that specifies this behaviour, but AFAICT this is what happens.
> >
> > I don't know how others work, but cx_Oracle starts a transaction when you
> > execute a statement, not when you open a cursor.
>
> Is there any material difference here? I mean, sure, you have a
> transaction, it'll show up in logs and stuff, but without any locks,
> it's unlikely to have much impact on the system. Unless you're
> creating and destroying a bunch of unnecessary cursors all the time,
> of course, but that'd be wasteful for other reasons.

Sure. If you commit the transaction and then execute another statement, you'll get a new transaction.

--047d7b15b2efca792c0508ed2237--