dbiRaw and odbc

Peter Dyk phdyk at home.com
Fri Nov 29 13:45:19 EST 2002


A couple of posts asked how to manipulate the BLOB retrieved by a query via
the odbc module. The answer is to use the attribute "value":

dbc = odbc.odbc('AAA')
crsr = dbc.cursor()
crsr.execute("select * from IDWAAA")
row = crsr.fetchone()
f = open(imageFileName, "wb+")
f.write(row[idwphotofield1].value)

Make sure to open the file in binary mode!

There does not seem to be a whole lot of documentation around on the odbc
interface. For instance, I only by chance stumbled on the value attribute,
since it is a build-in.







More information about the Python-list mailing list