On Sun, Dec 31, 2017 at 12:54 AM, Zac Goldstein <gol...@gmail.com> wrote: > I'm working in a session with `session.autoflush = False`, but pending > objects that I expunge get automatically added back in. It has something to > do with references held to the object. The object is not in session.new > immediately after expunging, but it seems to get added back in once the > reference is accessed.
you're likely running into save-update cascade and possibly the "backref" case which is more annoying, if you're actually trying to expunge specific objects while adding other related objects. save-update is detailed at http://docs.sqlalchemy.org/en/latest/orm/cascades.html#save-update and the specific thing with backrefs you can alter using the instructions at http://docs.sqlalchemy.org/en/latest/orm/cascades.html#backref-cascade. Using `del` liberally makes this bug more of a > nuisance than anything critical. I tried reproducing with a couple basic > examples, but it worked as it should. There's a lot going on in the code > where this is an issue, so before I put more time in to come up with a > minimum example etc, I just want to confirm that this isn't intended > behavior. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > 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 https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.