Python objects in an SQL Database

Boudewijn Rempt boud at rempt.xs4all.nl
Fri Apr 6 02:38:20 EDT 2001


Jeff Griffith <jgriffith at hbs.edu> wrote:
> While scanning Freshmeat I came across this

> http://freshmeat.net/projects/myobject.pm/

> ---- description ----

> MyObject is a PERL module that stores objects in a MySQL database. It 
> should be inherited by a class wishing to persist its objects in the database.

> --- / description ----

> After scanning the python newsgroup archive I came up with no previous 
> discussion about this, a Google search also turned up no public code.

> I'm familiar with the ZODB and I've heard rumors about a tighter 
> integration of Zope (python) with the Berkeley DB but am curious why 
> something like this isn't more popular?

> Mapping instance attributes to a database sounds somewhat useful...

>From what I understand of the perl code (so take my comments with a bit
of salt), all this does is storing fields in a database: not the whole
object, including methods and state. You'll have to define the fields
that will be stored yourself.

If that's true, then my dbobj Python package
(www.valdyas.org/python/dbobj.html) will do just as well. This
allows you to map tables to Python objects; you can even subclass
the resulting objects to add extra methods. It's used in kura
(www.valdyas.org/linguistics/index.html), and the version included in
that application is a bit more advanced.


-- 

Boudewijn Rempt  | http://www.valdyas.org



More information about the Python-list mailing list