From: <sk...@po...> - 2008-04-14 17:42:08
|
In the python-sybase documentation it says 0.39 implements Carsten Haese's type mapping extension to the DB-API. That specification is a bit ambiguous when it comes to naming the keys in the input and output maps. It says: When a value is fetched from the database, if the value is not None, its column type (as it would be indicated in cursor.description) is looked up in outputmap, and the resulting callable object is called upon to convert the fetched value... The DB-API uses integer type codes in the description tuple, not strings. PEP 249 says: The type_code can be interpreted by comparing it to the Type Objects specified in the section below. Later on it says: The type_code must compare equal to one of Type Objects defined below. What am I supposed to use as keys in my input and output maps? Python strings (as Carsten's document suggests)? Ints (implied by how type_codes are represeted in .description)? Type Objects? Is there a list somewhere of valid key values? Any example usage? I'm specifically interested in transparently representing dates and times using objects from Python's datetime module. Thanks, -- Skip Montanaro - sk...@po... - http://www.webfast.com/~skip/ |