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?
Werner
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
Werner