Re: [sqlalchemy] Re: can't delete object (AssertionError: Dependency rule tried to blank-out primary key column)

2014-11-06 Thread Jonathan Vanasco
I may try and work this out with my test case later -- I tried just about every permutation, but should have logged them. Thankfully the other half of SqlAlchemy could handle this. The ORM relationships are only used on a Web Display (and some db migration work). Everything is added as indivi

Re: [sqlalchemy] Re: can't delete object (AssertionError: Dependency rule tried to blank-out primary key column)

2014-11-06 Thread Michael Bayer
it’s probably that delete-orphan on the many-to-one, that’s pretty awkward. the single_parent=True flag is kind of saying, “you’re doing something crazy, are you sure?”. If you delete the Foo(), then every Bar will be deleted in any case via Foo.bar_all (“orphan” is defined as, not referre

[sqlalchemy] Re: can't delete object (AssertionError: Dependency rule tried to blank-out primary key column)

2014-11-06 Thread Jonathan Vanasco
For the next person: I was able to get around this by doing the following: * do not eagerload any of the relations, probably best to keep them out of the identity map altogether * use the sql expressions api to handle any migrations/work dbSession.execute( model.core.Foo.__table__\

[sqlalchemy] Re: can't delete object (AssertionError: Dependency rule tried to blank-out primary key column)

2014-11-06 Thread Jonathan Vanasco
After spending the morning, I realized this is actually a larger problem with SqlAlchemy mapping this existing database. Depending on how I structure the deletes, I get either an AssertionError or a sqlalchemy.exc.CircularDependencyError. I should have mentioned the model: class Foo(Base