Dinesh In theory you can store in either type(i have done it), however you should store in the binary column, blob
Vince On Wed, Jun 24, 2009 at 2:42 PM, Dinesh B Vadhia <dineshbvad...@hotmail.com>wrote: > 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:* vince spicer <vinces1...@gmail.com> > *Sent:* Wednesday, June 24, 2009 10:49 AM > *To:* Dinesh B Vadhia <dineshbvad...@hotmail.com> > *Cc:* tutor@python.org > *Subject:* Re: [Tutor] string pickling and sqlite blob'ing > > Pickle is more for storing complex objects (arrays, dict, etc). pickling a > string makes it bigger. > > I have stored large text chunks in text and/or blob columns compressed with > gzip.zlib.compress and extracted with gzip.zlib.decompress > > Comparison: > > import cPickle as Pickle > import gzip > > x = "asdfasdfasdfasdfasdfasdfasdfasdfasdf" > > print len(x) > >> 36 > > print len(Pickle.dumps(x)) > >> 44 > > print len(gzip.zlib.compress(x)) > >> 14 > > > Vince > > On Wed, Jun 24, 2009 at 11:17 AM, Dinesh B Vadhia < > dineshbvad...@hotmail.com> wrote: > I want to pickle (very long) strings and save them in a sqlite db. The > plan is to use pickle dumps() to turn a string into a pickle object and > store it in sqlite. After reading the string back from the sqlite db, use > pickle loads() to turn back into original string. > > - Is this a good approach for storing very long strings? > > - Are the pickle'd strings stored in the sqlite db as a STRING or BLOB? > > Cheers. > > Dinesh > > > >> >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> http://mail.python.org/mailman/listinfo/tutor >> >> > >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor