from flaskext.sqlalchemy import SQLAlchemy
import psycopg2
import psycopg2.extras


class _SQLAlchemy(SQLAlchemy):

    def apply_driver_hacks(self, app, info, options):
        """This method adds option to support hstore on psycopg2"""
if info.drivername == 'postgres':

    def _connect():
        conn = psycopg2.connect(user=info.username, host=info.host, port=
            info.port, dbname=info.database, password=info.password)
psycopg2.extras.register_hstore(conn)
return conn
options['creator'] = _connect
SQLAlchemy.apply_driver_hacks(self, app, info, options)
How to use Postgres' Hstore column with flask-sqlalchemy?