[Tutor] loading an image into a Postgre database

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Jun 21 23:38:34 CEST 2005


> Thankfully, you don't have to change much to fix the formatting bug.  The
> only thing you'll need to do is let the SQL cursor do the value formatting
> for you:
>
> ######
> sqlStatement = """INSERT INTO images (image)
>                   VALUES (%s);
> cur.execute(sqlStatement, (data_obj))
> ######


Hi Mike,


Gaaa.  I was a little sloppy there, wasn't I?  Let me fix that:

######
sqlStatement = """INSERT INTO images (image)
                  VALUES (%s);"""
cur.execute(sqlStatement, (data_obj,))
######


My apologies!



More information about the Tutor mailing list