[PYTHON DB-SIG] Python Database API

Anthony Baxter Anthony Baxter <arb@connect.com.au>
Wed, 16 Apr 1997 15:46:43 +1000

>>> Greg Stein wrote
> Hmm. I thought there was a spec for DBI (just checked... there is, but
> it doesn't cover the "generic" exceptions). Personally, I have no

I will document what I've done, and add it in.

I'd _like_ to see dbi become a seperate module, so we can share the
code across all who use it. I'm just not sure how independant it can be.

> I would say that any cursors associated with a closed connection become
> unusable. Closing cursors should not have an impact on the connection.

Yep. This should go into the API.

> I've never dealt with callproc. In truth, I'm not positive that it is
> needed after all. It seems to be quite possible to simply use execute()
> for store procedures in addition to (SQL) statements.

Ok, well, is _anyone_ using it? If not, can we drop it from the API?

> One interesting note: the ODBC module is apparently quite fast
> relatively to other mechanisms available to Python for accessing
> databases (e.g. ADO). You can *make* ADO go faster, but it takes a good
> amount of fine tuning and voodoo. Empirically, the ODBC module is simple
> to use (love that API!) and capable of being quite efficient.

I suspect that most of the database modules can be given quite a hefty
dose of go-faster-stripes, and made quicker. Does ODBC work on non-Windows

> To fetch/insert more than one row at a time, are you using the row count
> from fetchmany() and/or the arraysize attribute?

At the moment you set the cursor.arraysize, then call fetchmany(None). I've
got to add code to fetchmany() to change the arraysize - it will end up that
curs.arraysize = 10
will set curs.arraysize to 100. Doing a repeated fetchmany() with the same
number of rows will have the same effect as setting arraysize manually - 
it won't have to reallocate space internally, so should be faster.

Does someone "own" the API, or should I just make changes to the HTML and
mail it to the db-sig list?


DB-SIG  - SIG on Tabular Databases in Python

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