Storing files in a BLOB field via SQL

francois lepoutre franck.lepoutre at caramail.com
Thu Jun 10 03:16:32 EDT 2004


Hi

> I'm trying and searching for many days for an acceptable solution...
> without success. I want to store files in a database using BLOB
> fields.

This is a reasonable data organization scheme.

>The database table has an ID field (INT, auto_increment), an
> ORDER field (INT, for knowing the right order) and a "normal" BLOB
> field. It is planned to split large files in 64k-parts and sort these
> parts by the ORDER field.

Why split the BLOBs in 64k parts? A db works with pages blocks
that will not map these parts anyway. The structure of the database
should map your "application logic" not the other way round.

In a perfect world your blob data should be stored "as is",
whatever their size with no translation of any kind.

But this is personal opinion not law... Since most midlleware
software still tend to choke at transfer of heavy binay data.
A pity in 2004(:

> The main problem is the handling of the binary data. ...
>Does anybody of you have an idea?
> Any suggestions would be very helpful.

Blobs are now commonly supported by most db engines.
But midlleware is often getting in the way with hapazard
code translation (you want none) or size limitation (you
need none as well).

I have not tested mysql. Cannot talk. Test another
midlleware, if any. If it does not (i should), try an
other database and their associated midlleware.

I would dare to propose firebird (open source) thru
its python middleware or sybase asa (commercial).
They both have strong blob support.

François





More information about the Python-list mailing list