[Tutor] loading an image into a Postgre database
Mike Hansen
mhansen at cso.atmel.com
Wed Jun 22 15:15:07 CEST 2005
Thanks Danny. That did the trick. I think I had thought about putting the
variables in the execute statement, but I didn't run across any examples. I'll
need to read the DB API 2.0 docs some more.
Mike
Danny Yoo wrote:
>>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