I'm a beginner in Flask & I tried to make one of my table column as HSTORE in my model. But I got an error.
Can anyone point to me how I can use HSTORE type in flask app.
I have checked too many links and can't find anything helpful for me.
In SQLAlchemy manual, they documented that PostgreSQL HSTORE type as well as hstore literals are supported.
https://docs.sqlalchemy.org/en/13/dialects/postgresql.html#hstore-type
In my model, I have added the below code.
from sqlalchemy.dialects import postgresql
#.........
class Submission(db.Model):
id = db.Column(db.Integer, primary_key=True)
form_id = db.Column(db.Integer, db.ForeignKey('form.id'))
origin = db.Column(db.String())
form_data = db.Column(db.Hstore()) # I have also tried HSTORE(), hstore()
timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow)
But when I try to run my flask app, I got the below error.
AttributeError: 'SQLAlchemy' object has no attribute 'Hstore'
I'm using the latest version of Flask - 1.1.1.