Re: [sqlalchemy] session.merge() and detecting insertions and updates within the context of an HTTP handler

2019-01-11 Thread HP3
Thank you very much Mike! with session.no_autoflush: > obj = session.merge(my_thing) > for r in session.new: > > for r in session.dirty: > ... > session.new is showing the newly added :) I'll need to experiment more to make sure all my cases are covered.

Re: [sqlalchemy] session.merge() and detecting insertions and updates within the context of an HTTP handler

2019-01-11 Thread Mike Bayer
On Fri, Jan 11, 2019 at 11:39 AM HP3 wrote: > > Hello all, > > I'm using `session.merge()` within an HTTP handler, I would like to know > which objects have been newly added and which ones have been modified after > `merge()` completes. as you tried, the easiest way is to look in session.new

[sqlalchemy] session.merge() and detecting insertions and updates within the context of an HTTP handler

2019-01-11 Thread HP3
Hello all, I'm using `session.merge()` within an HTTP handler, I would like to know which objects have been newly added and which ones have been modified after `merge()` completes. Bare with me please ... I know there are `before_flush`, etc. events exactly for this scenario but I **only**