[Tutor] string pickling and sqlite blob'ing

Lie Ryan lie.1296 at gmail.com
Thu Jun 25 07:43:27 CEST 2009


Richard Lovely wrote:
> 2009/6/24 Dinesh B Vadhia <dineshbvadhia at hotmail.com>:
>> Hi Vince
>>
>> That's terrific!  Once a string is compressed with gzip.zlib does it make a
>> difference whether it is stored it in a TEXT or BLOB column?
>>
>> Dinesh
>>
>>
>>From the MySQL language reference:
> """A BLOB is a binary large object that can hold a variable amount of
> data. The four BLOB types TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB
> differ only in the maximum length of the values they can hold.
> 
> The four TEXT types TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT
> correspond to the four BLOB types and have the same maximum lengths
> and storage requirements. The only difference between BLOB and TEXT
> types is that sorting and comparison is performed in case-sensitive
> fashion for BLOB values and case-insensitive fashion for TEXT values.
> In other words, a TEXT is a case-insensitive BLOB."""
> 
> gzip.zlib outputs binary data, so you should use BLOB.
> Pickle, I believe, outputs an ascii string, so should use TEXT.

Although pickle output only ascii string, it is not meant to be human
readable at all. Basically there is no difference how it is stored as
long as what goes in is equal with what goes out. I can't think of a
need to sort or compare raw pickle data.



More information about the Tutor mailing list