Storing files in a BLOB field via SQL

Juergen Gerner J.Gerner at GernerOnline.de
Mon Jun 7 08:26:24 EDT 2004


Hi Irmen,

first of all, thanks for your help about compression & checksum!

> Is there a special reason why you can't store the whole file in a
> single BLOB? That's what it's a BLOB for, after all... L=Large :-)

Yes, there's a special reason. After reading a lot of documentation I
think it's better splitting large files in little blobs. It doesn't
matter if the SQL server is on the same machine as the application,
but if both parts are on different machines, large files have to be
transmitted over the network. During this transfer the application
isn't responding, I guess. So splitting would be much more flexible.
Additionally I think, splitting files makes the database more scalable
and the space on the harddrive better used.

But the splitting isn't my main problem. It's the way I transmit the
binary data to the database via an SQL syntax. Today I saw how
PhpMyAdmin handles binary data: it codes each byte in hexadecimal
values ("\0x..."). Is there any way to do something (or similar) with
Python, or maybe with PyQt/QString/QByteArray?

Thanks in advance!
Juergen



More information about the Python-list mailing list