Closed kennetpostigo closed 3 years ago
Are you using this in context of GraphQL or are you using it standalone?
@mickhansen we're using this in context of GraphQL
@kennetpostigo Then i would not suggest using includes at all.
How come?
Using includes would require reasoning about all the subfields of the field you are currently looking at, it's not impossible but has a few pitfalls.
I'd suggest simply resolving for each field and let dataloader make sure you end up with only 1 query.
Curious what the technical limitations are and where I can pitch in to make the cache more easily normalized, any guidance you can give @mickhansen would be awesome, would love to pitch in.
I honestly don't recall what level of support we have for includes at this time. An earlier version of graphql-sequelize
tried to reason about it but it was more trouble than it's worth as you only really gain a benefit with 1:1 associations.
@kennetpostigo you might want to check this out https://github.com/oney/sequelize-proxy It includes internal data loaders to batch any associations(hasOne, belongsTo, hasMany, belongsToMany) with where, order, limit and scopes.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi,
I have a 2 questions about usage of
dataloader-sequelize
:When using
dataloader-sequelize
withinclude
does it appropriately cache the associations by their model? So for example if I were to grab aUser
and useinclude
to also grab theirPost
, does it all get cached under that user? Or does theUser
get cached for user models andPost
get cached with post models?When using
dataloader-sequelize
if I were to grab aUser
and then use theUser
association methodgetPost
to grab theirPost
data, does the dataloader-sequelize hook into the association and check the cache first?