referential integrity
hi zopistas, Is there a way in zope to define restrictions as we now it from relational databases. In other words, is it possible to store only a reference of an object in a attribute of another object. Additionally, the zope database wouldn't allow to delete the referenced object while it's still referenced (in a attribute of another object). if this is somehow possible, it would make zope very, very powerfull. thanx, lukas
* Lukas Maag <lmaag@datacomm.ch> [010921 09:52]:
In other words, is it possible to store only a reference of an object in a attribute of another object. Additionally, the zope database wouldn't allow to delete the referenced object while it's still referenced (in a attribute of another object).
if this is somehow possible, it would make zope very, very powerfull.
thanx, lukas
because you are creating python classes whose persistent storage is completely transparent to the user, things like referential integrity become a functional feature of your program rather than a feature of the database. for example, if you have some Elf objects which must only ever exist as an attribute of Santa objects, you might simply make it so that you can only ever access Elves via a Santa API. IMO this is more powerful than the kinds of referential integrity you get in a RDBMS, since it's completely flexible: you could allow Elves to exist independently of Santa in special circumstances (the Chief Elf might be able to promote Elves, for example). hth seb
Lukas Maag writes:
In other words, is it possible to store only a reference of an object in a attribute of another object. That's easy!
You use a string values property and store the path to the referenced object.
Additionally, the zope database wouldn't allow to delete the referenced object while it's still referenced (in a attribute of another object). Zope does not support that directly. But you can use a ZCatalog to record the relation. I case, you are deleting something, you ask the catalog whether the object is still needed and reject deletion when it is still in use.
Dieter
participants (3)
-
Dieter Maurer -
Lukas Maag -
seb bacon