How to insert / retrieve a file stored as a BLOB in a MySQL db using python

Posted by Phage on Stack Overflow See other posts from Stack Overflow or by Phage
Published on 2009-08-18T14:50:58Z Indexed on 2010/05/16 6:50 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

I want to write a python script that populates a database with some information. One of the columns in my table is a BLOB that I would like to save a file to for each entry.

How can I read the file (binary) and insert it into the DB using python? Likewise, how can I retrieve it and write that file back to some arbitrary location on the hard drive?

© Stack Overflow or respective owner

Related posts about python

Related posts about mysql