DB API

Boudewijn Rempt boud at rempt.xs4all.nl
Sun Jan 2 07:13:17 EST 2000


Simon Faulkner <News at titanic.co.uk> wrote:
> Hi All,

> Where can I find the instructions for the DB API?

> I have managed to figure out the .connect() and .fetchone() methods
> but am flagging with the rest.

> The Python Database API Specification 2.0 document does not realy show
> me the methods or examples that I need to get started and the MySQLdb
> documentation is deliberatly vague to discourage use of the _mysql.
> methods (so you use the proper API?)

If you're using to MySQL, then you'd better not go to far using all
the options and stuff from DB-API II - if you use connect, execute and
fetchall, you've exhausted the capabilities of the database. No need
for commit, rollback or things like that - MySQL doesn't support them.
There's one area where MySQL has functionality beyond DB-API II, and
that's in the area of autoincrement columns, where you can get quite
easily get back the autoincrement values back after insertion.

Also, with most^H^H^H^Hall database servers, what you really need to do is
ask for a few rows, and fetch them immediately from the server. Keeping
large resultsets on the server and nibbling piecemeal from them is a
recipe for performance problems.

-- 

Boudewijn Rempt  | http://denden.conlang.org



More information about the Python-list mailing list