Sunday, April 10, 2016

SQLAlchemy - JSON not changing on commit

If your changes to a JSON, JSONB, or HSTORE field aren't saving after you commit, then you need to wrap your field in the MutableDict shown here: http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#sqlalchemy.dialects.postgresql.HSTORE

Saturday, April 9, 2016

SQLAlchemy - AttributeError: type object 'JSONB' has no attribute 'lower'

This error happened because I mistyped "db.column" instead of "db.Column" when I was creating my database model using SQLAlchemy.

This might be your problem if db.create_all() isn't creating all the columns you expected.