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

Chain dataloaders #6

Closed
jkimbo opened this issue Oct 3, 2022 · 0 comments · Fixed by #7
Closed

Chain dataloaders #6

jkimbo opened this issue Oct 3, 2022 · 0 comments · Fixed by #7

Comments

@jkimbo
Copy link
Owner

jkimbo commented Oct 3, 2022

You should be able to chain dataloaders together. For example:

def resolve_grandparent(person, info):
  return parent_loader.load(person.id).then(lambda parent: parent_loader.load(parent.id))

graphql-python/graphene#1391 (comment)

jkimbo added a commit that referenced this issue Oct 4, 2022
This PR changes how the dataloader batching functionality works. Rather
than trying to "detect" if a future has a "deferred_callback" in the
execution context, we create a singleton `DataLoaderBatchCallbacks`
which all dataloaders add their `dispatch_queue` functions to when
needed. We can then run all the callbacks in the execution context to
complete the SyncFuture's. This allows us to chain dataloaders together.

Fixes #6

Diff-Id: daffd
@jkimbo jkimbo closed this as completed in #7 Oct 4, 2022
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

Successfully merging a pull request may close this issue.

1 participant