Boolean PassiveDefault('f') columns don't get default values under SQLite

Issue #1296 resolved
Former user created an issue

Setting a PassiveDefault('f') on a Boolean column works under PostgreSQL. But under SQLite, new objects have that column incorrectly set to True. See the attached test case.

I'm using: SQLAlchemy 0.5.2 SQLite 3.6.9

Comments (3)

  1. Mike Bayer repo owner

    The PassiveDefault correctly assigns a default value of f to the column, where in SQLite there is no real "boolean" datatype - an INSERT into this table populates the column with the string value f.

    The Boolean datatype in SQLAlchemy when applied to SQLite uses 1 and 0 for true/false values. So you should specify the value 1 with PassiveDefault in conjunction with SQLite.

    PassiveDefault is not intended to be backend agnostic.

  2. Log in to comment