Re: Applause for ZODB! And a question: How do you get pending change info from a transaction object?

Sean Upton <[email protected]> Sat, 28 Apr 2018 08:34:13 -0600
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
See below.

> On Apr 28, 2018, at 5:17 AM, David Pesta <[email protected]> wrote:
> 
> If I have the transaction object in hand and it's about to commit, I need to know just the objects that have changed, so wouldn't your suggestion mean that I have to traverse every object in the entire repository to look for _p_changed flags?

No, the current connection object holds a list of objects that have registered themselves as changed:

>>> import transaction
>>> txn = transaction.get()
>>> connection = txn._resources[0]
>>> changed = connection._registered_objects

That said, I suspect there are better ways to accomplish, at the application level, higher-level notifications, than you might get by trying to sandwich something between your app and the database.  It might make more sense, letting the database handle caching and invalidation, and using an application-level synchronous event system (zope.event plus zope.lifecycleevent is one reasonable choice) to capture changes at the app level, and save something like a UUID (not an oid) to a message queue, if you application benefits from that kind of thing.

Sean

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.