text file vs. cPickle vs sqlite a design question

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Apr 11 14:48:44 EDT 2007


En Wed, 11 Apr 2007 13:40:02 -0300, Dag <f98dawa at dd.chalmers.se> escribió:

> I have an application which works with lists of tuples of the form
> (id_nr,'text','more text',1 or 0).  I'll have maybe 20-50 or so of these
> lists containing anywhere from 3 to over 30000 tuples.  The actions I
> need to do is either append a new tuple to the end of the list, display
> all the tuples or display all the tuples where the last element is a 1
>
> Basically what I'm wondering is the best way to store these data  
> stuctures
> to disc.  As the subject mentioned I've basically got three approaches.
> Store each list as a text file, pickle each list to file or shove the
> whole thing into a bunch of database tables.  I can see pros and cons
> with each approach.  Does anybody have any advice as to whether any of

 From your description, none of these three approaches is obviously better.
Try to isolate the data from its storage, and use the easiest way now  
(pickle perhaps?).
This way you can change it later easily - maybe to use sqlite if you need  
more difficult queries.

-- 
Gabriel Genellina



More information about the Python-list mailing list