[DB-SIG] RE: column type casting

brian zimmer bzimmer@ziclix.com
Fri, 23 Mar 2001 06:35:32 -0600


Daniel,

What's the API like for your datahandlers?  Are they written in C or Python?  Should we collect a couple examples and present them
in the PEP?

In addition to being able to handle different data types, the functionality might want to include events/callbacks for the lifecycle
of the executions.  As I stated, this is useful for collecting the auto increment values for certain columns and isn't so much the
morphing of data.

brian

> > Data handlers are one way to do this. In mxODBC I chose the positional
> > approach for the converter function. Still missing is some sort
> > of generic data input/output handler device. I remember that
> > Andy's MySQL
> > module has a nice way to this -- it's easy for him though, because
> > most of his code is in Python which is simple to extend by
> > subclassing.
> >
> > One way to implement this would be by using callbacks which are
> > triggered by certain type mappings. They are cumbersome to use
> > though...
>
> In sapdbapi, you can
> - install data handler for each column of a cursor
> - use the connection to specify data handlers for specific types which are
> then used for every cursor
>
> In addition, there are some default handler for date/time types: conversion
> from the internal format to either <module time> tuples or to strings using
> a time.strftime format.
>
> Yet another thing we could standardize on (although maybe we should ask a
> few users what they found useful).
>
> Daniel
>
> --
> Daniel Dittmar
> daniel.dittmar@sap.com
> SAP DB, SAP Labs Berlin
> http://www.sapdb.org/
>
> _______________________________________________
> DB-SIG maillist  -  DB-SIG@python.org
> http://mail.python.org/mailman/listinfo/db-sig