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

Update dataloader docs to use aiodataloader #1189

Closed
jkimbo opened this issue Apr 26, 2020 · 3 comments · Fixed by #1190
Closed

Update dataloader docs to use aiodataloader #1189

jkimbo opened this issue Apr 26, 2020 · 3 comments · Fixed by #1190
Labels
3.0 Fix/Release version 3.0 📖 documentation

Comments

@jkimbo
Copy link
Member

jkimbo commented Apr 26, 2020

graphql-core dropped support for the Promise library (since asyncio is now the official way to do async code in Python). @syrusakbary has already created an asyncio version of dataloader: https://github.com/syrusakbary/aiodataloader . We should update the documentation.

@jkimbo jkimbo added ✨ enhancement 3.0 Fix/Release version 3.0 labels Apr 26, 2020
@jkimbo jkimbo self-assigned this Apr 26, 2020
@jkimbo jkimbo changed the title Implement asyncio version of dataloader Update dataloader docs to use aiodataloader Apr 26, 2020
@nerdstrike
Copy link

Just to note that aiodataloader seems to be unmaintained at this time. I put in a request to remove a deprecated python import months ago and it has gone neglected.

@jkimbo jkimbo removed their assignment Nov 11, 2020
@asia653
Copy link

asia653 commented Oct 25, 2021

user1_future = user_loader.load(1)
user2_future = user_loader.load(2)

user1 = await user1_future
user2 = await user2_future

user1_invitedby = user_loader.load(user1.invited_by_id)
user2_invitedby = user_loader.load(user2.invited_by_id)

print("User 1 was invited by", await user1_invitedby)
print("User 2 was invited by", await user2_invitedby)

Is this code in the docs correct? According to the codebase, dataloader returns a Promise that resolves into an array of values, so awaiting the future should return an array with a single value

@cpmsmith
Copy link

Just to note that aiodataloader seems to be unmaintained at this time. I put in a request to remove a deprecated python import months ago and it has gone neglected.

Note to onlookers: the PR mentioned here, syrusakbary/aiodataloader#11, has since been merged, and aiodataloader released a version on 2022-01-24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 Fix/Release version 3.0 📖 documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants