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

M.-A. Lemburg mal at egenix.com
Tue Dec 30 17:23:24 EST 2003


Guido van Rossum wrote:
>>>I guess 2.3 hasn't been out long enough to get the various db api
>>>authors to make the switch.  Perhaps a DB-API standard update should
>>>be issued (e.g. DB-API 2.1) that requires using this for Python 2.3?
>>
>>No, that would not be in the spirit of the DB-API standard.
> 
> 
> Why is standardizing on one universally available type not in the
> DB-API's spirit?  Does the DB-API allow implementers to use
> non-standard integer or string types?

The DB-API standard is designed to allow pluralism and
defines clear interfaces to support data types that are
specific to databases, such as date/time, binaries,
blobs, etc.

The aim is to make it easy for the
module programmers to comply to the specification while
at the same time giving users who are looking for cross-
database module compatibility a base to build upon.

The long history of the DB API specification and the
great number of database modules have proven the success
of this approach and I don't see any need to change this.

Your comparison of date/time values and strings/integers
is flawed: dealing with date/time values is not straight
forward and each date/time type implementation will put
emphasis on different aspects.

Also note that the DB API does not enforce usage of
the builtin string types or integers. This is on purpose,
since module implementors may want to use their own
decimal type, or use Unicode objects instead of string
objects.

The module implementor should have the right to choose
and that's what the DB API standard allows him to do.

>>The spec already includes a reference the datetime module,
>>but in its current state it's not too useful for C extensions:
>>
>>	http://www.python.org/peps/pep-0249.html
> 
> 
> That's a useful criticism.  How can this be addressed?  I don't know
> enough about implementing a database adapter to understand the needs
> from a C extension's perspective.  Is it just the need to create a
> datetime instance from C code efficiently?  Can you point me to the
> docs for the mxDateTime C-level API?

http://www.egenix.com/files/python/mxDateTime.html#API

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Dec 30 2003)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the DB-SIG mailing list