DBI cursor behaviour with multiple statements?

Paul Boddie paul at boddie.net
Tue Oct 1 11:56:55 EDT 2002


mark.charsley at REMOVE_THIS.radioscape.com (Mark Charsley) wrote in message news:<memo.20021001113236.1724B at a.a>...
> In article <23891c90.0209300554.5b37c195 at posting.google.com>, 
> paul at boddie.net (Paul Boddie) wrote:
> 
> >   "SELECT * FROM table WHERE column IN %s"
> 
> Does that work? I've never been able to pass in a list of things like that 
> in either ODBC or ADO from C++. Which means:
> a) the python library isn't cacheing the execution plan, and is just 
> building a new building a new SQL statement with each call (which is going 
> to have serious consequences), or 

The only DB-API module that I've tried with "IN" that seemed to
support it was psycopg (out of that one and pyPgSQL). I don't know how
the psycopg people have implemented it, though, and from certain
conversations I've had, I don't think PostgreSQL supports/-ed proper
parameter binding anyway.

> b) it's possible to make DB calls from python that can't be made from C++, 
> or
> c) I've been an idiot

Ruling out the last one, ;-) I would suspect that everything depends
on the database library or DB-API module concerned, given that
database vendors won't have overlooked this one. Have you tried using
mxODBC to see if this kind of thing is supported there?

Paul



More information about the Python-list mailing list