[sqlalchemy] UPDATE ordering in flush

2017-08-12 Thread Ronuk Raval
Hi there, I'm using Python 3.6.2, SQLAlchemy 1.1.13, and PostgreSQL 9.6.3 I've got a non-trivial relationship involving a nullable composite foreign key and cannot get SQLAlchemy to correctly order its UPDATE statements. It's easier to explain with an MWE: import sqlalchemy as sa import sqlalc

[sqlalchemy] Re: UPDATE ordering in flush

2017-08-13 Thread Ronuk Raval
On Sunday, August 13, 2017 at 1:35:47 PM UTC-4, Jonathan Vanasco wrote: > > When I've been unable to handle things like this with cascades (which you > already using), I use `session.flush(objects=SPECIFIC_OBJECTS_LIST)` to > only flush a single object. That usually gets me out of these situatio

Re: [sqlalchemy] Re: UPDATE ordering in flush

2017-08-14 Thread Ronuk Raval
On Sunday, August 13, 2017 at 11:03:51 PM UTC-4, Mike Bayer wrote: > alternatively you can emit the UPDATE directly, so that no other > aspects of B are affected, and skip history events so that the B isn't > added to the flush unless something else changes: > > @archived.setter > def