Database experiences in Python: Good or Bad?

Daniel Dittmar daniel.dittmar at sap.com
Wed Aug 14 15:52:01 CEST 2002


Brad Clements wrote:
> What's killing me today is that sapdbapi doesn't represent
> times/dates as class objects, like I got with gvibDA.. I have a lot
> of XSLT code that uses xml_pickle objects.. and a pickled timestamp
> from gvib doesn't look anything like that from SAP.
>
> In fact, SAP timestamps are 20 character strings.. really ugly.

It is easy to register conversion callbacks with sapdbapi.

- write conversion functions from the SAP DB values to any
object/representation you like
- create a dictionary which maps the SAP DB type names 'Date', 'Time',
'Timestamp' to those functions
- connection.setTypeTranslation (conversionMapping)

see the end of sapdbapi.py for examples like converting to module time
tuples

Daniel

--
Daniel Dittmar
SAP DB, SAP Labs Berlin
http://www.sapdb.org






More information about the Python-list mailing list