Re: Python DB-API 2.0 oddity (was: I receieved an example of - Mailing list pgsql-general

From Marco Colombo
Subject Re: Python DB-API 2.0 oddity (was: I receieved an example of
Date
Msg-id 1115033986.17311.41.camel@Frodo.esi
Whole thread Raw
In response to Python DB-API 2.0 oddity (was: I receieved an example of Rekall script)  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-general
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
> <query> 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


pgsql-general by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [Dbdpg-general] Re: 'prepare' is not quite schema-safe
Next
From: "Julian Mehnle"
Date:
Subject: Re: 'prepare' is not quite schema-safe