Object Database (ODBMS) for Python

Patrick K. O'Brien pobrien at orbtech.com
Fri Aug 29 19:38:39 CEST 2003


"Paul D. Fernhout" <pdfernhout at kurtz-fernhout.com> writes:

> In Smalltalk, typically persistant objects may get stored and
> retrieved as proxies, which is made possible by overriding the basic
> storage and retrieval methods which are all exposed etc. Maybe Python
> the language could do with more hooks for persistances as a PEP? I
> know there are some lower level hooks for access, I'm just wondering
> if they are enough for what you may want to do with PyPerSyst to make
> an elegant API for persistant objects (perhaps better unique ID
> support?), where you could then just go:
> 
>    import persistanceSystem import *
>    foo = MyClass()
>    PersistanceSystem_Wrap(foo)
>    # the following defaults to a transaction
>    foo.x = 10
>    # this makes a two change transaction
>    PersistanceSystem_StartTransaction()
>    foo.y = 20
>    foo.z = 20
>    foo.info = "I am a 3D Point"
>    PersistanceSystem_EndTransaction()
>    # what happens to foo on garbage collection? It persists!
>    ...
>    # Other code in another program
>    import persistanceSystem import *
>    foo = PersistanceSystem_Query(x=10, y=20, z=30)
>    print foo.info # prints --> "I am a 3D Point"
> 
> That MyClass instance called foo and the related variable changes gets
> stored in an ODBMS in transactions somewhere... Then I could do the
> same for the Pointrel System somehow using the same simple hooks.

Adding hooks to Python itself has been discussed (look for the
persistence SIG), and not gone anywhere, as far as I know.  And I'm
not sure it would be so good to add to the language.  One reason is
that it would either only be able to capture very simple transactions,
or would require quite a framework to handle all the requirements for
real use cases.  This is one area where it would be hard to please
everyone, and I think the Python language has to appeal to a broad set
of uses.

-- 
Patrick K. O'Brien
Orbtech      http://www.orbtech.com/web/pobrien
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------




More information about the Python-list mailing list