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):
        __tablename__ = 'foo'
        id = Column(Integer, primary_key=True)
        bar_latest_id = Column(Integer, ForeignKey("bar.id"), nullable=True)

        bar_latest = relationship("Bar", 
primaryjoin="Foo.bar_latest_id==Bar.id", uselist=False, 
cascade="save-update, merge, delete, delete-orphan", single_parent=True, )
        bar_all = relationship("Bar", primaryjoin="Foo.id==Bar.foo_id", 
cascade="save-update, merge, delete, delete-orphan", single_parent=True, 
post_update=True)


    class Bar(Base):
        __tablename__ = 'bar'
        id = Column(Integer, primary_key=True)
        foo_id = Column(Integer, ForeignKey("foo.id"), nullable=False)

-- 
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