I have a SQLAlchemy model with a Unicode column. I sometimes insert unicode values to it (u'Value'), but also sometimes insert ASCII strings. What is the best way to go about this? When I insert ASCII strings with special characters I get this warning:
SAWarning: Unicode type received non-unicode bind param value ...
How do I avoid this? What is the proper way to insert my different types of strings?
Thre are several options:
warnings.simplefilter('ignore', sqlalchemy.exc.SAWarning)
.warnings.filterwarnings('ignore', '^Unicode type received non-unicode bind param value', sqlalchemy.exc.SAWarning)
.String(convert_unicode=True)
instead of Unicode
type.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With