mickhansen / graphql-sequelize

GraphQL & Relay for MySQL & Postgres via Sequelize
MIT License
1.9k stars 172 forks source link

Disable dataloading? #418

Closed ozthegreat closed 6 years ago

ozthegreat commented 7 years ago

Hey hey. One of our associations does a join based on two fields. With the data loading this then tries to translate it to an IN with just one field which obviously won't work. Would be good to be able to pass an option that disables the data-loading. From a quick scout through the code the underlaying lib does have a batchLoad option that can be set to false

mickhansen commented 7 years ago

You want to disable the dataloader permanently or for specific calls? Specific call support would have to be in dataloader and we could then pass in appropriate options

ozthegreat commented 7 years ago

@mickhansen Specific calls ideally but I guess permanently as well wouldn't be bad to have as an option. From routing round it looks likes it's disabled if it's inside a transaction anyway?

mickhansen commented 7 years ago

Permanently is likely to ruin your performance as we're definitely moving away from doing prefetching.

ozthegreat commented 7 years ago

@mickhansen You're not wrong. BUT all our queries are behind redis so our DB queries can take the hit. And, more importantly, because we're joining on two fields data loading just doesn't work in the current form. Would have to be changed from WHERE post_id IN (1,2,3,4) to something like WHERE (post_id = 1 and uni_id = 5) OR (post_id = 2 and uni_id = 3) etc etc

mickhansen commented 7 years ago

@ozthegreat Definitely open for a way to disable the dataloader completely.