mercredi 2 mars 2016

SQLite+SQLAlchemy+Python3: Could not decode to UTF-8 column

I have a SQLAlchemy model, in a Flask app, defined like this:

class Food(Model):
    __tablename__ = 'food'
    id = db.Column(db.Integer, primary_key=True)
    short_desc = db.Column(db.String(80))
    sci_name = db.Column(db.String(250))

I'm trying to perform a simple query using a pre-filled SQLite database, but when I call Food.query.all() I receive the error:

(sqlite3.OperationalError) Could not decode to UTF-8 column 'food_sci_name' with text 'Actinidia chinensis �Zesy002� (Gold3)'

I tried changing the engine text_factory to str, to bytes but none of these changes have made any difference.

Aucun commentaire:

Enregistrer un commentaire