On Fri, Sep 27, 2002 at 08:11:17AM -0400, Ben Logan wrote:
> One question I have is regarding how to store my data in the database.
> The records I'm dealing with could be nicely represented by a set of
> interrelated Python objects.  Is it better to simply pickle these
> objects and store the results in the SQL database, or better to
> rebuild the objects from the database rows each time the data is
> retrieved?

There's no "right" answer, but I would be inclined to bust them down
into normal SQL objects.  That way you have a second way to access
the data (the *SQL CLI) if you need to repair something, and the data
is also portable to a non-Python application if the need should
ever arise.  

This assumes the data can be conveniently represented as:
1) A row of SQL objects (strings, numbers, date fields...)
2) Rows in related tables with a common key field linking them
3) A table with 'key' & 'value' columns (or maybe 'section', 'key' &
   'value').

If not, then maybe you want to keep the data together in Pickle
units rather than breaking it down further.  At that point, you can
investigate ZODB, which automatically does the (un)pickling for you
using an intuitive get-database-object, use-dotted-fields-and-the-
assignment-operator-to-review/update-the-data, call-a-commit-method
interface.  It doesn't do everything a SQL database does; in
particular I don't think it handles multiple processes accessing the
database simultaneously (as opposed to a multithreaded Webware
application which is one process); but supposedly ZEO does such
multiplexing.

-- 
-Mike (Iron) Orr, [EMAIL PROTECTED]  (if mail problems: [EMAIL PROTECTED])
   http://iron.cx/     English * Esperanto * Russkiy * Deutsch * Espan~ol


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to