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

M2M without on_conflict #1046

Open
Forceres opened this issue Jul 6, 2024 · 4 comments
Open

M2M without on_conflict #1046

Forceres opened this issue Jul 6, 2024 · 4 comments

Comments

@Forceres
Copy link

Forceres commented Jul 6, 2024

I think that on_conflict part in add_m2m would be very useful for avoiding duplicates in m2m, why it isn't supported yet?

@sinisaos
Copy link
Member

sinisaos commented Jul 6, 2024

@Forceres There was a PR for it, but it never took off. Maybe @dantownsend has a better way to solve that problem. As you can see in that PR, it's just a few lines of code (with combination of unique constraints in joining_table) that would be useful to prevent duplicate entries in M2M.

@Forceres
Copy link
Author

Forceres commented Jul 8, 2024

@Forceres There was a PR for it, but it never took off. Maybe @dantownsend has a better way to solve that problem. As you can see in that PR, it's just a few lines of code (with combination of unique constraints in joining_table) that would be useful to prevent duplicate entries in M2M.

A lot of vital PRs were not merged. What a pity!

@sam2x
Copy link

sam2x commented Feb 23, 2025

I second this requirement.

@dantownsend Is there any reason this PR is not validated ? Could you please share any strategy on sorting/accepting PR
?
You provided an answer on the PR without merging it, was it a mistake ?

This is a big win PR as it's small code, fast to review/confirm it doesnt introduce no edge-case, and the benefit are majors:

  • Semantic Ambiguity: Duplicate entries make the meaning of the M2M table unclear.
  • Data Integrity Issues: Duplicates complicate data integrity.
  • Query Count Complexity: If I rely on this to retrieve unique relationships or counts, it become more complex as you need to account for and filter out duplicates.
  • Performance Degradation: Unnecessary duplicate data increases storage space and can potentially slow down queries.
  • Violates Relational principal: Relational databases are designed for efficient representation of relationships.

Therefore having duplicates doesnt serve well the quality of this lib that has been quoted as "production-ready" on some thread...
To tackle this, and providing you support, please indicate if you need help on qualifying/sorting making priority triage on PR/features that are worth (To me this is one of them). Many can help (including me).

Best regards,

@Forceres
Copy link
Author

I second this requirement.

@dantownsend Is there any reason this PR is not validated ? Could you please share any strategy on sorting/accepting PR ? You provided an answer on the PR without merging it, was it a mistake ?

This is a big win PR as it's small code, fast to review/confirm it doesnt introduce no edge-case, and the benefit are majors:

* **Semantic Ambiguity**: Duplicate entries make the meaning of the M2M table unclear.

* **Data Integrity Issues**: Duplicates complicate data integrity.

* **Query Count Complexity**: If I rely on this to retrieve unique relationships or counts, it become more complex as you need to account for and filter out duplicates.

* **Performance Degradation**: Unnecessary duplicate data increases storage space and can potentially slow down queries.

* **Violates Relational principal**: Relational databases are designed for efficient representation of relationships.

Therefore having duplicates doesnt serve well the quality of this lib that has been quoted as "production-ready" on some thread... To tackle this, and providing you support, please indicate if you need help on qualifying/sorting making priority triage on PR/features that are worth (To me this is one of them). Many can help (including me).

Best regards,

Many old issues that must be in production-ready ORM are not resolved yet (for instance, reversed relationships). I was forced to move to SQLAlchemy.

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

3 participants