title: Saving Python Numpy Structure As MySQL Blob
body: <p>One of my programs creates a very large numpty array that I wish to save as a Blob within a database as accessing the array is far faster than going back to the previous level and creating it. I can add it to the database by saving an .npz file to disc using:-</p>
  
  <pre><code>import numpy as n
  n.savez(outfile,**kwargs)
  </code></pre>
  
  <p>and saving this file to the database with:-</p>
  
  <pre><code>myData = open(outfile, 'rb').read()
  sql = "INSERT INTO myTable (BlobColumn) VALUES (%s)"
  cursor.execute(sql, (myData,))
  </code></pre>
  
  <p>Whilst this works it seems somewhat inelegant but I cannot figure out how to save it directly to the database? </p>