am trying out creating a web app using python flask framework. I've installed flask-mysql library to interact with mysql db. However, am having trouble getting rows as dictionaries rather than tuples. With the usual python-mysql library, it's a matter of adding "cursorclass=MySQLdb.cursors.DictCursor," to my database handle.
from flaskext.mysql import MySQL
app = Flask(__name__)
mysql = MySQL()
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'user'
app.config['MYSQL_DATABASE_PASSWORD'] = 'password'
app.config['MYSQL_DATABASE_DB'] = 'mydb'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)
I've tried adding app.config['MYSQL_DATABASE_CURSORCLASS'] = 'DictCursor' but that doesn't work. It instead works with flask-mysqldb from documentation here.
Also am confused about flask-mysql and flask-mysqldb libraries, which one should I be using.