strange circular dependency error with only one object being changed

Issue #3990 duplicate
Adrian created an issue

I have the following code: https://gist.github.com/ThiefMaster/9cea43683142912e5ffb0fa3b5d8d0a9

It fails with a circular dependency error even though there is only a change to p (however, both p and gal show up in sess.dirty when I print it right before the commit, but is_modified only returns True for p).

It also works fine if I uncomment the expire call - but of course that's an awful workaround. post_update=True on the gallery relationship also does the job but it seems like an SQLAlchemy bug to me since there's only one object with changes which can be flushed/committed just fine if I do a manual expire...

Comments (2)

  1. Mike Bayer repo owner

    post_update is currently required for any mutually-dependent FKs relationship. having it not be necessary for UPDATE only is what #1063 addresses.

  2. Log in to comment