[Tutor] string pickling and sqlite blob'ing
Alan Gauld
alan.gauld at btinternet.com
Thu Jun 25 01:44:22 CEST 2009
"Dinesh B Vadhia" <dineshbvadhia at hotmail.com> wrote
> I want to pickle (very long) strings and save them in a sqlite db.
Why?
Why not just store the string in the database?
If that turns out to be a problem then think about other
options - like splitting it into chunks say?
But until you know you have a problem don't try to
solve it!
> - Is this a good approach for storing very long strings?
Probably not.
> - Are the pickle'd strings stored in the sqlite db as a STRING or BLOB?
They could be stored either way, thats up to how you define
your tables and write your SQL.
In general I expect databases to handle very large quantities of data
either as blobs or as references to a file. Is this a valid approach?
Write the long string (assuming its many MB in size) into a text
file and store that with a unique name. Then store the filename
in the database.
But first check that you can't store it in the database directly or
in chunks.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list