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
Nested included tables are not returned if their parent's attributes field is "[]" #12888
Comments
I am experiencing the same issue. I have a deeply nested model with a specific attribute needing to be returned and sequelize is not populating the models and respective children (nested) after the query is run. What's odd is I am seeing the correct query hit the database, so seems like an object mapper issue after the data is returned from the db. |
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂 |
Still an issue, as far is I know (I've not been using sequelize for a long time). |
Thanks, @ivanpera. I looked at their object mapper and it's some pretty gnarly looking code. Our team has been able to get around this by including the primary key id in the parent model. |
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂 |
This issue has been automatically marked as stale because it has been open for 14 days without activity. It will be closed if no further activity occurs within the next 14 days. If this is still an issue, just leave a comment or remove the "stale" label. 🙂 |
We are still experiencing this issue in our applications. This should not be closed (unless it's fixed in another PR/issue) and is a very serious issue for an object mapper. |
Thanks for re-opening! |
Issue Description
The database is structured as following:
Tables:
Associations:
When calling UserModel.findAll() including both AModel and DModel, but specifiyng AModel attributes as "[]", no instance of DModel is returned.
When adding a field to the attributes of AModel, DModel is returned correctly.
What are you doing?
Here is the link to the SSCCE for this issue: LINK-HERE https://github.com/ivanpera/sequelize_issue
What do you expect to happen?
Given the following query
I expect res["a"]["d"] to be defined
NOTE: "a" and "d" are the names of the tables in associations, as defined in their init functions
Environment
Issue Template Checklist
How does this problem relate to dialects?
Would you be willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: