On May 1, 2007, at 3:02 AM, Andreas Jung wrote:

> ResultProxy_instance.cursor.description returns the 7-tuple as  
> defined in the Python DB API containing information about the  
> result set.
>
> The type_code (the second element of each tuple) is an integer:
>
> (('id', 20, 5, 8, None, None, None), ('idgattung', 23, 2, 4, None,  
> None, None), ('bezeichnung', 1043, 43, 255, None, None, None),  
> ('version', 1043, 0, 30, None, None, None), ('stand', 1114, 19, 8,  
> None, None, None), ('format', 1043, 3, 10, None, None, None),  
> ('status', 23, 1, 4, None, None, None), ('umfang', 23, 1, 4, None,  
> None, None), ('seiten', 23, 1, 4, None, None, None), ('faxabruf',  
> 1043, 0, 50, None, None, None), ('dateiname', 1043, 11, 255, None,  
> None, None), ('originalname', 1043, 30, 255, None, None, None),  
> ('idautor', 23, 1, 4, None, None, None), ('idfassung', 23, 1, 4,  
> None, None, None), ('neudat', 1114, 19, 8, None, None, None),  
> ('aedat', 1114, 19, 8, None, None, None), ('bemerkung', 25, 0, -1,  
> None, None, None), ('summary', 25, 74, -1, None, None, None))
>
> AFAIK all type_codes are specific to the underlying Python DB  
> module. Is there a way to determine the type of a column for a  
> given resultset (as returned by executing a SQL statement directly)  
> independent of the underlying database?
>
> The reason why I am asking: I am building a generic database  
> adapter for Zope 2 where I need map the types of the columns to  
> some Zope internal
> mapping.

you can get  back the SQLAlchemy types via the attribute  
result.context.type_map.  but those are not yet mapped to python  
types (theres an ancient ticket to do so which I have never found a  
way to implement which I like).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to