Re: [Tutor] string pickling and sqlite blob'ing

2009-06-25 Thread vince spicer
erence whether it is stored it in a TEXT or BLOB column? > > Dinesh > > > > *From:* vince spicer > *Sent:* Wednesday, June 24, 2009 10:49 AM > *To:* Dinesh B Vadhia > *Cc:* tutor@python.org > *Subject:* Re: [Tutor] string pickling and sqlite blob'ing > >

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-25 Thread Dinesh B Vadhia
bove first since the post-processing after the select is on the entire string. Dinesh Message: 3 Date: Thu, 25 Jun 2009 00:44:22 +0100 From: "Alan Gauld" To: tutor@python.org Subject: Re: [Tutor] string pick

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-25 Thread Richard Lovely
2009/6/25 Lie Ryan : > > 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. > > __

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Lie Ryan
Richard Lovely wrote: > 2009/6/24 Dinesh B Vadhia : >> 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 obj

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Richard Lovely
2009/6/24 Dinesh B Vadhia : > 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

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Alan Gauld
"Dinesh B Vadhia" 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

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Dinesh B Vadhia
tring 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

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Kent Johnson
On Wed, Jun 24, 2009 at 1:17 PM, Dinesh B Vadhia 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() t

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread vince spicer
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 = "asdfasd

[Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Dinesh B Vadhia
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 approac