[Persistence-sig] "Straw Baby" Persistence API

Jim Fulton jim@zope.com
Tue, 23 Jul 2002 10:32:45 -0400


Ilia Iourovitski wrote:
> For RDBMS based storages api should
> provides the following method:

I'll first note that, if these methods are needed
at all, they should be methods on a specific data manager.
They do not affect the transaction or the persistence
frameworks.


> create(object) storage shall populated id from rdbms
> which is usually primary key.

This should not be necessary. One should be able to
design a data manager that detected new objects and
assigned them ids when referencing objects are created.

> delete(object) 

I can imagine a datamanager that lacked garbage collection could
need this.

> load(object type, object id)->object

An object type should be unnecessary. If a data manager
needs to track this sort of information, it should
embed it in the object id.

Note also, that persistence applications load most objects
automatically through object traverssal. It is often
necessary to explicitly load one or more root objects to
provide a starting place for traversl.


> query(string, parameters)->list of objects or smart
> collection
> 
> Those methods can be placed in
> Persistence/IPersistentDataManager.py

No, these methods are specific to particular data manager
APIs, although I can imagine a number of data managers sharing an
API like the one above. Note that IPersistentDataManager.py is
an interface for use by persistent objects. It does not include
all data-manager methods. Similarly,
Transaction.IDataManager.IDataManager is the data-manager API
used by the transaction framework.

Data managers will implement
Persistence.IPersistentDataManager.IPersistentDataManager and
Transaction.IDataManager.IDataManager as well as application APIs
like the one you propose above. Perhaps there should be some
common data-manager application API somewhat like the one you propose
above.

Jim


-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org