[DB-SIG] Optional DB API Extensions
Thu, 25 Oct 2001 20:52:20 +1000
On Wednesday, October 24, 2001, at 01:04 AM, M.-A. Lemburg wrote:
> Title: Optional Database API Extensions
I would call this DB API 2.1 to avoid confusion, or if all the
methods do end up being optional, simply updating the existing
DB API 2.0 PEP. I think it is important that the current
specification ends up in a single document, as opposed to being
split up into two separate PEP's.
I also would like the connection method:
Returns a SQL quoted version of the given variable as a
string, suitable for execution by the database backend.
>>> print con.quote(42)
>>> print con.quote("Don't do that!")
'Don''t do that!'
>>> print con.quote(time.time())
TO_DATE('01-Jan-2001 12:01','DD-MMM-YYYY H24:MI')
I'd also add cursor methods for Python 2.2 iterators:
Return the next row from the currently executing SQL
A StopIteration exception is raised when the result set is
This method will raise a NameError exception if run under
Python earlier than Python 2.2.
Another optional method may be a call to have the fetchXXX methods return
dictionaries rather than sequences, as this seems to be a common
and feature request.
Is it worth adding the transaction isolation level stuff I outlined in
the DB API 3 strawman I put out a month or two ago? There didn't appear
to be much interest in these, but I may be wrong. (I will be getting
around to replying to the last round of comments on the 3.0 strawman
soon, as I have spare time again as of today).
Anyway, the proposal seems good from my point of view. Thanks for
the effort :-)
Stuart Bishop <firstname.lastname@example.org>