title: MySQL fetchall() - how to get data inside a dict rather than inside a tuple
body: <p>I've a table having columns as <code>id</code>, <code>col1</code>, <code>col2</code>, <code>col3</code>. I executed the query in this way.</p>
  
  <pre><code>cur.execute(query)
  row = cur.fetchall()
  </code></pre>
  
  <p>Can I get the data of <code>row</code> inside a <code>dict</code> ,ie I want to pass this result as a result to an <strong>api</strong>.</p>
  
  <p><code>cur.fetchall()</code> will yield me result in the following format <code>((id,col1,col2,col3),(id,col1,col2,col3),(id,col1,col2,col3))</code></p>
  
  <p>Can I get result in </p>
  
  <pre><code>[
     {id:value,col1:value,col2:value,col3:value},
     {id:value,col1:value,col2:value,col3:value},
     {id:value,col1:value,col2:value,col3:value}
  ]
  </code></pre>
  
  <p>I know this concept that I can loop around <code>fetchall()</code>, and get values using dictionary concept, ie</p>
  
  <pre><code>rows = cursor.fetchall()
  for row in rows:
     id = row['id']
     col1 = row['col1']
     and so on...
  </code></pre>
  
  <p><strong>Can I pass <code>rows</code> as a dictionary??</strong></p>