Re: [sqlalchemy] event updating sibling objects: commit() vs. flush()

2021-02-06 Thread Gord Thompson
Thanks, Mike. I was tempted to try and find a way to get at the session from within the event handler but thought that it might be a "Bad Idea"™ given that we were only given the `connection` to play with. Your suggestion works fine in 1.4. (As I mentioned in one of the dev meetings, I'm now

Re: [sqlalchemy] event updating sibling objects: commit() vs. flush()

2021-02-05 Thread Mike Bayer
On Fri, Feb 5, 2021, at 6:37 PM, Gord Thompson wrote: > Hi all. While trying to get more fluent with ORM I looked into a solution for > this Stack Overflow question . > For a many-to-one relationship only one child object can have >

[sqlalchemy] event updating sibling objects: commit() vs. flush()

2021-02-05 Thread Gord Thompson
Hi all. While trying to get more fluent with ORM I looked into a solution for this Stack Overflow question . For a many-to-one relationship only one child object can have `is_default=True`. If we add a new child object or update an existing one