Can you share a stack trace please ?   Encoding operations can occur in many 
places and I don't see that identified here.   Also this is Python 3?  What OS 
platform and ODBC driver / configuration as well?  If freetds please share your 
freetds config too.

> On Mar 4, 2016, at 2:51 PM, Tim Pierson <tim.pier...@gmail.com> wrote:
> 
> I've seen a couple of issues regarding mssql and drivers handling of strings 
> but I haven't been able to resolve my problem.  
> 
> I have a flask app with flask-sqlalchemy models defined and a simple query is 
> throwing the above complaint about decoding the string. 
> 
> My connection string:
> mssql+pyodbc://[...]/[...]?trusted_connection=yes&charset=utf8&deprecate_large_types=True
>  A 
> 
> Which is given to the SQLAlchemy class instance db after the initialization 
> of the app with:
> 
> db.init_app(app)
>  
> The offending model:
> 
> class Annotations(db.Model):
>     id = db.Column(db.Integer, primary_key=True)
>     creation_date = db.Column(db.DateTime, default=datetime.datetime.now)
>     created_by = db.Column(db.String, nullable=False)
>     annotation = db.Column(sqlalchemy.Unicode, nullable=False)
>     annotation_type_id = db.Column(db.Integer, 
> db.ForeignKey('AnnotationTypes.id'))
> 
> 
> The query:
> 
> db.session.query(Annotations.annotation).all()
> 
> I've replaced the original column type db.String with sqlalchemy.Unicode on 
> the field that throws the error as per an earlier question on this list but 
> it hasn't resolved the problem.  
> 
> Could someone offer any pointers?
> 
> Thanks,
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to