On Aug 11, 2012, at 5:50 AM, Warwick Prince wrote:
>>
>> On Aug 10, 2012, at 5:19 AM, Warwick Prince wrote:
>>
>>> Hi All
>>>
>>> If I have a Column() object, is there a way of determining the sqlalchemy
>>> type from the dialect specific type? e.g. I have a Postgres TIMESTAMP
>>> column, and I want to be able to map that back the a sqa DateTime type.
>>
>>
>> column.type._type_affinity
>>
> I have moved on now with this information, but I've hit a snag which appears
> to be bug in either core or possibly (more likely) mysqlconnector.
>
> When I ask for column.type._type_affinity on a LONGBLOB column in a MySQL
> database, it returns _Binary which is not correct (Should be LargeBinary).
> Please confirm if this is a core issue, or should I go hunting in the
> connector code?
_type_affinity is semi-public right now so is possibly not exactly tailored
towards what you're doing right now. Your best bet is to keep using it, but
also use a lookup table (dictionary: {LONGBLOB:_LargeBinary} ) to make
corrections in cases like these.
A public feature version of _type_affinity would be able to have more general
use contract but I don't want to tweak _type_affinity directly right now as I'd
need to spend time determining the impact of that.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.