title: Python Flask: Get database rows as dictionary
body: <p>I'm building an application using Flask MySQLDb and wondering how to return database rows as dictionaries (like PHP's FETCH_ASSOC). The default <code>fetchall()</code> method of the cursor class returns a tuple, and there's nothing about returning a dict in the <a href="https://mysqlclient.readthedocs.org/en/latest/index.html" rel="nofollow">docs</a> of the underlying library.</p>
  
  <p>So far I've been executing code the following format, but getting a dict with column names as keys would really help:</p>
  
  <pre><code>g.cursor.execute('SELECT email, password FROM users WHERE email = %s', [request.form['email']])
          row = g.cursor.fetchall()
  </code></pre>