executemany ('SELECT ...') (was: [DB-SIG] DBAPI-2.0 clarifica tions)

Dittmar, Daniel daniel.dittmar@sap.com
Mon, 19 Mar 2001 18:37:40 +0100


> I don't see your problem... if the DB does not support multiple
> result sets, then .nextset() can simply be left unimplemented or
> be implemented to always raise an exception (see the DB API).

I could implement .executemany on SELECTs in two ways:
- array execute, which would give one result set
- loop over the input list to create multiple result sets

Authors of databases without array execution also have two choices
- loop over the input list to create multiple result sets
- implement a smart result set which detects the end of one resultset and
executes the SELECT with the next parameter list, thus giving the illusion
of a single result set

> Note that the original idea behind .nextset() was to allow
> stored procedures to pass back multiple result sets. The idea

Right. 

> Snice it is not defined in the DB API spec, the feature is deemed
> to be implementation specific. Multiple selects in one execution
> block don't really make any sense if executed from within Python,
> since passing in query parameters is not preformance relevant and
> it only makes debugging code harder... IMHO, at least.

In contrast with array INSERTs/UPDATESs, array SELECts are a rather exotic
feature. So standardizing it's behaviour in a way that requires additional
work by the driver implementor is probably a waste of time.

For those liking either behaviour, it's possible to write a db independant
module for it.

Daniel

--
Daniel Dittmar
daniel.dittmar@sap.com
SAP DB, SAP Labs Berlin
http://www.sapdb.org/