Thank you Mike,

So basically, I should move the cleanup from 
`after_commit`/`after_rollback` to `after_transaction_end` and do it 
**only** if `transaction.parent is None`?

Recap'ing the solution (Jason's and yours combined):

1- On `after_flush`, call `history_meta.create_version()` for each object 
that is changing so its `XYZHistory` instance is created and can be stored 
within `session.info`.
2. On `before_commit`, do `session.add()` for each history instance 
(`XYZHistory`) in `session.info` and increase `version` of each object 
associated to each history instance. 
3. On `after_transaction_end`, if `transaction.parent` is `None`, clean up 
`session.info`.

True?

And, even if there was a `session rollback` and/or `soft rollback`, the 
`session.info` would have been cleaned up by step 3. True?



-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to