On 09/26/2016 01:24 PM, HP3 wrote:
It seems like 0.9 does not have 'parent' in `SessionTransaction`. Instead, it has `_parent`. Would `_parent` suffice?
yes, use _parent. i pushed up docs to 1.0 and 1.1 which indicate that _parent is the original attribute in the absense of .parent.
On Monday, September 26, 2016 at 12:09:55 PM UTC-5, HP3 wrote: 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 <http://session.info>`. 2. On `before_commit`, do `session.add()` for each history instance (`XYZHistory`) in `session.info <http://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 <http://session.info>`. True? And, even if there was a `session rollback` and/or `soft rollback`, the `session.info <http://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 <mailto:sqlalchemy+unsubscr...@googlegroups.com>. To post to this group, send email to sqlalchemy@googlegroups.com <mailto:sqlalchemy@googlegroups.com>. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
-- 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.