[DB-SIG] WHat's the status of DB modules and datetime.py supp ort?

Federico Di Gregorio fog at initd.org
Fri Jan 2 08:51:30 EST 2004


Il ven, 2004-01-02 alle 13:22, M.-A. Lemburg ha scritto:
[snip]
> However, that is *not* the reason of why I think making the
> DB API more restrictive is a bad thing. The spirit of the DB
> API spec has always been to give developers a guideline in
> creating new database modules while not making the implementation
> too burdensome. As a result we have quite a few database modules
> out there which implement the spec, including some of the extensions.
> They also often come with a multitude of new developments
> that are permitted by the spec (e.g. customized row objects
> that behave like a sequence).

this is exactly what i mean (and i wholeheartly agree with everything i
deleted): the DBAPI is very good because does not say "results must be
tuples" but "results must be accessible as tuples". unfortunately this
is not true for the whole dbapi.

> By making the spec more restrictive we would not only make
> life of the developers harder, but also break backwards
> compatibility of most database modules that work perfectly
> OK today.

completely agreed.

> Many of the things people have asked about in the past
> are really not intended to be implemented at the level
> the DB API is working at. Object relational wrappers,
> ADO style access, etc. can easily be programmed on top
> of the DB API and indeed have been implemented quite
> successfully for a number of database modules out there.

and agreed again.

> > my oppinion is that the part of the dbapi related to typecasts is
> > flacky. 
> 
> Probably because it only defines them for the input side
> and not the output side :-)
> 
> It is certainly a weak point in the spec and we should
> do something about it for the next revision.

exactly. let's start with a first very simple proposal that, imho, will
improve the dbapi a lot:

objects returned in result sets should be directly useable as bound
variables, without needing a call to wrapping functions/constructors.
e.g., if datefield is of (any) date type and curs is a cursor:

curs.execute("INSERT into test VALUES (%s)", (module.DateFromTicks(x),))
curs.execute("SELECT datefiled from test")
d = curs.fetchone()[0]
curs.execute("INSERT into test VALUES(%s)", (d,))

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                fog at debian.org
INIT.D Developer                                           fog at initd.org
  We are all dust, Saqi, so play the lute
                    We are all wind, Saqi, so bring wine. -- Omar Khayam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Questa parte del messaggio =?ISO-8859-1?Q?=E8?= firmata
Url : http://mail.python.org/pipermail/db-sig/attachments/20040102/7c86d7fd/attachment.bin


More information about the DB-SIG mailing list