Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.python Subject: Commit: postgres on cursor and sqlite on connection Date: Mon, 09 Nov 2015 16:44:33 +0100 Organization: Decebal Computing Lines: 23 Message-ID: <878u675g9q.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="11938"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18esV4SD9y7Irgqm+vJDOMMed/gWfQoHng=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:fuysvmnFdtTRt7fg5D15iveKp2Q= sha1:CW4BdMk3r5P6R4oWs9wpwUCrTFw= Xref: csiph.com comp.lang.python:98540 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;') -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof