On 09/09/2011 05:07 PM, Michael Bayer wrote:
On Sep 9, 2011, at 11:01 AM, werner wrote:Tracking down where one forgot to use u'' e.g.: somemodelinstance.somecol = 'somevalue' instead of: somemodelinstance.somecol = u'somevalue' is sometimes not that easy to track down as the warning doesn't provide any hints. C:\python27\lib\site-packages\sqlalchemy-0.7.2-py2.7.egg\sqlalchemy\engine\default.py:448: SAWarning: Unicode type received non-unicode bind param value param.append(processors[key](compiled_params[key])) Tried to come up with a patch but can't figure out how/where this warning is generated. Could it include e.g. the model class and column name?This warning is emitted by the datatype and has no awareness of the column to which it is attached (it could be associated with many) nor is the column in question passed in, nor is there even necessarily a column in use. The column itself then has no awareness of the ORM or any kind of model objects, etc. To track the warning, have the warning raise an exception: http://docs.python.org/library/warnings.html
Thanks for the detailed explanation and the solution. Werner -- 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.
