Home:ALL Converter>How to use SQLAlchemy HSTORE in Pyramid?

How to use SQLAlchemy HSTORE in Pyramid?

Ask Time:2013-02-20T20:59:35         Author:uralbash

Json Formatter

I have a model using the new PostgreSQL HSTORE support added to SQLAlchemy 0.8:

class Gateway(Base):
    __tablename__ = 'gateway'
    id = Column(Integer, primary_key=True)
    access = Column(Mutable.as_mutable(HSTORE), nullable=False, unique=True)

But when I run session.query(Gateway).all(), the following exception is raised:

ValueError: Attribute 'access' does not accept objects of type <type 'dict'>

Could you help me to solve this problem?

Author:uralbash,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14980472/how-to-use-sqlalchemy-hstore-in-pyramid
yy