X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3B4FE535B3 for ; Mon, 2 May 2005 08:39:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82163-01 for ; Mon, 2 May 2005 11:39:39 +0000 (GMT) Received: from Nazgul.esiway.net (Nazgul.ESIWAY.NET [193.194.16.154]) by svr1.postgresql.org (Postfix) with ESMTP id C9ABC5337C for ; Mon, 2 May 2005 08:39:37 -0300 (ADT) Received: from Megathlon.ESI (Ghost.esi.it [193.194.16.225]) by Nazgul.esiway.net (8.13.1/8.13.1) with ESMTP id j42BdS1W019440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 2 May 2005 13:39:28 +0200 Received: from Frodo.esi (Frodo.ESI [10.10.10.13]) (user=marco mech=CRAM-MD5 bits=0) by Megathlon.ESI (8.12.11/8.12.11) with ESMTP id j42BdS2D020018 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Mon, 2 May 2005 13:39:28 +0200 Subject: Re: Python DB-API 2.0 oddity (was: I receieved an example of From: Marco Colombo To: Karsten Hilbert Cc: pgsql-general@postgresql.org In-Reply-To: <20050502115605.B566@hermes.hilbert.loc> References: <1a4.372310a7.2fa6dc0b@aol.com> <20050502115605.B566@hermes.hilbert.loc> Content-Type: text/plain Organization: ESI srl Date: Mon, 02 May 2005 13:39:46 +0200 Message-Id: <1115033986.17311.41.camel@Frodo.esi> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.207 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200505/43 X-Sequence-Number: 77391 On Mon, 2005-05-02 at 11:56 +0200, Karsten Hilbert wrote: > > The key is getting the "cursor". Once you have a cursor you can do inserts, > > updates and deletes, like > Huh ? Pardon me ? Doing inserts, updates and deletes via a > cursor ? The PostgreSQL documentation clearly says that the > part of a cursor definition must be a SELECT: > > http://www.postgresql.org/docs/7.4/static/sql-declare.html > > (I am well aware that SELECT queries may have side > effects that change data in the backend such as in > "select add_new_customer()" etc.) > BTW, look at this page (with the Oracle driver): http://www.zope.org/Members/matt/dco2/dco2doc cursor.execute("INSERT INTO TEST (name, id) VALUES (:name, :id)", name="Matt Kromer", id="1") I believe there are databases that allow you to send SQL statements (any kind, not only SELECTs) only in a cursor (either implicit or explicit), hence the name for the cursor object. .TM. -- ____/ ____/ / / / / Marco Colombo ___/ ___ / / Technical Manager / / / ESI s.r.l. _____/ _____/ _/ Colombo@ESI.it