Modelling and persistence
What are object-oriented databases?
On this page
An object database persists objects and their relationships using a model close to the application’s object model. Traversing a stored graph can feel natural. Ask how the database handles identity across sessions, schema evolution and queries spanning many objects before committing to that representation.
Worked example
Python# Install the ZODB package before running this example.
from ZODB import DB
from persistent.mapping import PersistentMapping
db = DB(None)
with db.transaction() as conn:
track = PersistentMapping(title="Overture")
conn.root.featured = track
conn.root.encore = track
with db.transaction() as conn:
assert conn.root.featured is conn.root.encore
db.close()Explore class relationships in the OOP Playground