[DB-SIG] date/time handling

Robert Brewer fumanchu at amor.org
Mon Aug 7 19:54:32 CEST 2006


Mario Frasca wrote:
On 2006-0806 14:01:27, Robert Brewer wrote:
> > > but then also data *going* to the database must be
> > > clearly typed.
> >
> > Yes. The value-adaptation layer must be aware of the target column types.
> 
> I think that the value adaptation layer should not be aware
> of the target column types, it should, according to me,
> base every choice on local information, that is: the type
> of the incoming data, be it *from* the database (and the
> type information is present in most engines) or *to* the
> database (then the type information should be agreed on,
> that is what we are doing here).  if the user sends a string,
> it will not be translated and the user is responsible for it
> being a valid string representation of the typed value
> to be stored in the column.

Then you are adding zero value in the DB-API layer over what every Python DB wrapper already does. That works great until you write integration code for multiple legacy databases, where some dates are stored in ADO DBDATETIME, some are TEXT in "YYYYMMDD" format, and some are SQLite "typeless". Providing the DB-API adaptation layer with both the Python type and the database type can relieve the vast majority of that burden from the user. It works in Dejavu, and exists there in direct response to the limitations of the approach you describe (which Dejavu did previously).


Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/db-sig/attachments/20060807/f4931d39/attachment.htm 


More information about the DB-SIG mailing list