lundi 14 mars 2016

Why does SQLAlchemy boolean column fail with "TypeError: an integer is required, found str"

Here's an answer your own question to help other out who may also hit this error.

I'm using SQLite3 from Python and using SQLAlchemy to load my objects via the ORM. I have a column specified as:

the_column = sqlalchemy.Column(sqlalchemy.Boolean, nullable=False, default=False)

I have manually added a boolean column to my table via:

ALTER TABLE Users ADD the_column INTEGER DEFAULT FALSE NOT NULL;

Yet when I run the app I get the error:

TypeError: an integer is required, found str. Or something like this.

What is going on here?

Aucun commentaire:

Enregistrer un commentaire