Skip to content

Cascade delete issues with Overhead #218

Description

@nvernooy

Overheads are not deleted when its Project is deleted.

I added a "cascade='all'" to the Overheads relationship in Projects.

But then deleting a Project caused a SQLAlchemy error:

StaleDataError: DELETE statement on table many to many

I'm assuming from the many-to-many relationship between Overheads and BudgetItems.

Using the solution here: http://stackoverflow.com/questions/28824401/sqlalchemy-attempting-to-twice-delete-many-to-many-secondary-relationship
And adding
engine.dialect.supports_sane_rowcount = engine.dialect.supports_sane_multi_rowcount = False
to init.py fixed the error.

Keeping this issue open in case there are any side effects.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions