> On 3 Sep 2016, at 01:36, HP3 <[email protected]> wrote:
> 
> Thank you Mike,
> 
> I will strongly consider creating a PR for an alternative solution.
> 
> I would need to dig into the library to learn the basics of sqlalchemy 
> architecture though. So far, I have only used 0.9.x and few of the recipes. 
> 
> Recommendations for "reading/learning" material I should get on first to 
> tackle something like this?

The history_meta example works by using a before_flush event to call 
“create_version” on all the objects in the session.dirty and session.deleted 
lists. create_version examines the object to see if it really has changed, and 
if so, creates an entry in the history table.

You should be able to reuse most of this code to only create versions at commit 
time. I think I would do something like this:

1. In a before_flush hook, check to see if the object has really changed (using 
the code from create_version). If it has, save it away in a set somewhere.

2. In a before_commit hook, iterate over that set and create the actual history 
entries.

Simon

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

Reply via email to