In my Flask application, in order to get results in dictionary format in MySQLdb, I added the statement:
app.config['MYSQL_CURSORCLASS'] = MySQLdb.cursors.DictCursor
I got the error
kwargs['cursorclass'] = getattr(MySQLdb.cursors, current_app.config['MYSQL_CURSORCLASS'])
TypeError: getattr(): attribute name must be string
My application was running perfectly fine before adding this statement. After some searching, I found out that the error seems to be caused by the given line
db = mysql.connection.cursor()