[DB-SIG] DB-API 1.1

M.-A. Lemburg mal@lemburg.com
Thu, 21 May 1998 11:58:39 +0200


I'd like to start discussing updating/extending the DB-API 1.0 to
a new version. IMHO, this needs to be done to
	a. clearify a few minor tidbits
	b. enable a more informative exception mechanism

You can have a look at an alpha version of 1.1 at:
	http://starship.skyport.net/~lemburg/DatabaseAPI-1.1.html

Major additions are the new dbi-exception classes (which use the
1.5 class exception mechanism, thus allowing to catch all DB-related
exceptions with the Error-base class, or just a specific subclass
of it), .nextset() and a few statements about the return values
of the .fetch*() methods in case there's nothing left to be fetched.

Some other suggestions:

1. Instead of defining the connection constructor to be named
   <modulename>, I think Connect(...) is a better choice (helps porting
   applications from one DB to another.

2. We should come up with a reasonable package structure for database
   access, e.g. to give the discussion a starting point:

[Database]
	[<name of database>]
		[dbi]
	[<name of database>]
		[dbi]

You'd then write:

from Database.Oracle import *
db = Connect('...')
c = db.cursor()
c.execute('...',dbi.dbiDate(...))

When porting to another database, only 'Oracle' would have to changed
to the other DBs name (in the ideal case ;-).

3. cursor.description should be well defined, always return 7-tuples,
   but allow None to be passed as synonym for 'data not available'.

4. Fix some standard for date/time values. I won't comment,
   since I am a little biased on this one ;-)

Awaiting your comments.

-- 
Marc-Andre Lemburg
----------------------------------------------------------------------
             | Python Pages:  http://starship.skyport.net/~lemburg/  |
              -------------------------------------------------------