Hi Michael,
I’m not looking for the old value, I’m trying to get the history within
after_flush to reflect changes on both sides of a backrefed relationship,
regardless of which side initiated the update.

recall that my earlier problem was that an updated many-to-one backref
relationship did not appear in the change history. i.e. when I created a
Chapter like this…

chapter = Chapter(title='Intro to Book2', book=book2)

… then book2.chapters did not appear in the change history within
after_flush.

your suggestion to use load_history() solved this, but for some reason it
only works when of *creating* and not *updating*. it seems like this should
be a pretty similar situation to the code pasted above :

chapter.book = book1

my expectation is that assigning a new book to the chapter should make
book1.chapters and book2.chapters appear in the change history when using
load_history() (the first has had a chapter removed, the latter has had a
chapter added), but they don’t. it’s odd though, that they will if I just
access the relationships first, as in this code:

print book1.chaptersprint book2.chapters

chapter.book = book1

I hope that makes the problem and my expectations more clear.

thanks,
chad
​
​

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to