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


Groups > comp.lang.python > #98545

Re: Commit: postgres on cursor and sqlite on connection

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Commit: postgres on cursor and sqlite on connection
Date Mon, 9 Nov 2015 10:46:24 -0700
Lines 23
Message-ID <mailman.184.1447091232.16136.python-list@python.org> (permalink)
References <878u675g9q.fsf@Equus.decebal.nl>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de KUg6XsBCNNq1iyqiBpUd1AYPbR/wkjMUSaEsYFHFN0kA==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.034
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'true,': 0.04; 'sqlite': 0.09; 'statements': 0.09; 'commit': 0.15; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '2015': 0.20; 'do.': 0.22; 'am,': 0.23; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'message-id:@mail.gmail.com': 0.27; 'looks': 0.29; 'question:': 0.29; 'transaction': 0.30; 'code': 0.30; 'received:google.com': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'doing': 0.38; 'received:209': 0.38; 'several': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'cecil': 0.84; 'to:name:python': 0.84; 'westerhof': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=dclta+2dJAFm5Q9tAsHyL5IzFSSXDmh4WtBm5Lj9Juo=; b=DLo0ocDo7iSSN3N9XyOvh1q+vdndjy+9k0IKydtJw3trDPwQg569NHF5d0/0WpaLtl qyFhvLrN8h8Nu2tSceGqfMC7Epb71VfQACxV/swifh11N88FciF6u//UxNuvByOQ+zNJ Zp6+i7ioSC1h9X4OrI2rIv4Gor2eQqqUk1IJni1zlQ0J36yQSHntEW2GnnWL0ulu/2O3 ZnH1mGiMcIUrZRSb9ph0F5bSz0HA4jeaaI3TAYizfMLSlCCwgMpZqXrUq6qls1q0QfQf UCtmwX7u9VAdzMwiyMyEojKOD4E4xMIN75mCkvcrn1ThIaXWRheuKnys2bcWVBI+Q3KA sEHQ==
X-Received by 10.50.136.132 with SMTP id qa4mr20873588igb.68.1447091223970; Mon, 09 Nov 2015 09:47:03 -0800 (PST)
In-Reply-To <878u675g9q.fsf@Equus.decebal.nl>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98545

Show key headers only | View raw


On Mon, Nov 9, 2015 at 8:44 AM, Cecil Westerhof <Cecil@decebal.nl> wrote:
> I have written some code I like to use with several databases. At the
> moment sqlite and postgres. It looks like with progres I can use:
>   cursor.execute('COMMIT;')
> but that with sqlite I need to use:
>     conn.commit()
>
> Is this true, or am I doing something wrong?
>
> When I use
>   cursor.execute('COMMIT;')
> with sqlite, I get:
>     sqlite3.OperationalError: cannot commit - no transaction is active
> While
>     conn.commit()
> does what it should do.
>
> Before I do my statements I use:
>   cursor.execute(BEGIN TRANSACTION;')

This looks like it answers your question:

http://stackoverflow.com/questions/9773200/python-sqlite3-cannot-commit-no-transaction-is-active

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Commit: postgres on cursor and sqlite on connection Cecil Westerhof <Cecil@decebal.nl> - 2015-11-09 16:44 +0100
  Re: Commit: postgres on cursor and sqlite on connection Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-09 10:46 -0700
  Re: Commit: postgres on cursor and sqlite on connection dieter <dieter@handshake.de> - 2015-11-10 07:53 +0100

csiph-web