Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] auto_delete_orphans not support back_populates #738

Open
CroMarmot opened this issue May 8, 2024 · 2 comments
Open

[Feature] auto_delete_orphans not support back_populates #738

CroMarmot opened this issue May 8, 2024 · 2 comments

Comments

@CroMarmot
Copy link

auto_delete_orphans seems only support backref, not support back_populates

    auto_delete_orphans(Magnet.tags)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/listeners.py", line 246, in auto_delete_orphans
    raise ImproperlyConfigured(
sqlalchemy_utils.exceptions.ImproperlyConfigured: The relationship argument given for auto_delete_orphans needs to have a backref relationship set.

however in 2.0 doc https://docs.sqlalchemy.org/en/20/orm/backref.html says

The relationship.backref considered legacy, and use of relationship.back_populates with explicit relationship() constructs should be preferred.
@jamesrusso
Copy link

Yes, just ran into this.

@jamesrusso
Copy link

Did a quick PR which seems to fix it for me #740, the tests could use some work to handle this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants