[DB-SIG] What DB-API compliant interfaces are there?

Greg Stein gstein@microsoft.com
Thu, 18 Sep 1997 02:05:31 -0700


>	From:	Andrew Kuchling [SMTP:amk@magnet.com]
>	Sent:	Tuesday, September 09, 1997 1:48 PM
>	To:	db-sig@python.org
>	Subject:	Re: [DB-SIG] What DB-API compliant interfaces
are there?
>	
>	...
>		True enough, but it's something of a pity.  It's really
cool
>	if Python presents identical interfaces to different databases,
but
>	the capability isn't really advertised very much.  (It would
also help
>	if the mSQL module, which is probably the most common, obeyed
the
>	DB-API.)

Please be wary here. The (initial) intent of the API was to expose
database functionality in a similar (but not exact) way across multiple
databases.The interface was meant to degrade if certain functionality
was not present in a particular database (e.g. as I recall mSQL doesn't
have data binding nor cursors).

The API was meant to follow the standard Python philosophy of "simply
expose the functionality, then deal with high-level abstractions in
Python". Hopefully, by minimizing abstractions within the API itself,
DBAPI implementors would not have as much work. If somebody truly needs
database independence, then Python-level abstractions can be built.

Note: the above philosophy is why the fetch methods return lists of
tuples rather than, say,  a more powerful datatype that provides
attribute-based access to column values (where attribute names match
column names). Search the SIG archives for "DatabaseTuple" for a way to
do that.

At a minimum, providing a "similar-as-possible" API across databases
means that learning time and coding time is greatly reduced, and
therefore beneficial. Trying to make them equal is a wicked slippery
slope. I gave up on an mSQL interface when I first tried a year and a
half ago, but as I recall it was because mSQL didn't have binary columns
(since it doesn't have data binding and binary is hard to represent in a
textual SQL statement). It should be possible to actually do most of an
mSQL interface.

-g

_______________
DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________