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
through: {attributes: []} does not remove attributes #5590
Comments
We need the id for deduplication. |
This may be a reason to have a "join" parameter. It would run a join against a table without needing the data in those tables. Something like:
|
Wait, i just looked at your model query again, i don't see any include statements? And you have the through stament as a top level option. Please include your actual code and i can see if there's any issues. |
I just edited the formatting. My include was spaced in too far, making it look like it was on the same level as the through. What I have there is (was) the actual code. |
Hmm with that code it shouldn't select anything, that's odd, should just work. |
If you have a chance to verify this behaviour, perhaps we can mark this a bug and work on a fix. |
#5602 may be related; I can't seem to specify which attributes are selected on the through table. Instead it looks like an all-or-nothing op |
I'll mark as a bug untill i can verify either way. |
+1. It will work. |
@ningshen That will great reduce deduplication performance since we can no longer match primary keys though. |
This was a relatively simple fix, so I backported it to my installed sequelize (v3.24.0). The change works as expected with normal output. However, the issue still exists if you set Took me a while to figure out, because I was still getting the through table keys in my output. When I removed http://stackoverflow.com/questions/38930799/how-to-remove-through-table-attributes If it's another simple fix to correct this, I'd be more than happy to test it on my system. |
@jeff-kilbride feel free to open a PR to back-port to v3 |
includeIgnoreAttributes: false, solves the problem in sequelize 4. |
I need to use includeIgnoreAttributes in order to exclude with
|
Thanks, works for me! |
includeIgnoreAttributes: false makes the through: { attributes: [] } superfluous. But sometimes you need to join model attributes. I hope this can be fixed. |
Hello, this issue is old and our issue templates have changed since then; investigating this issue as-is would need extra effort from maintainers (and our time is really short). Can someone please open a new issue about this, filling our modern templates, to save time from the maintainers? Especially including a nice SSCCE, preferably from our sequelize-sscce repository. For those hoping for a fix, doing this would greatly help and in theory is something anyone encountering this issue should be able to do. Thanks for understanding! Don't forget to link to this issue in the new issue. |
We have this issue still in Sequilize 6.3.5 |
2 days I spent looking for the right answer and here it was. You don't know how much I am relived right now!!!!!!! |
Setting through attributes to [] doesn't exclude the id columns from being selected.
The model query:
Defining the association:
The result query:
This is a major problem in postgres, as this query will fail because the group by must include the through table primary keys, which subsequently makes the query not function.
The text was updated successfully, but these errors were encountered: