-
Notifications
You must be signed in to change notification settings - Fork 768
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
graphene-django v3 has broken Data Loaders #1263
Comments
@felixmeziere you are right that graphene v3 means that the Promise based dataloader no longer works. This is because graphql-core v3 dropped support for custom backends in favour of using asyncio. I've been trying to find a solution for Strawberry and I think I have one now: strawberry-graphql/strawberry#1313 (which should be possible to port to Graphene by using middlewares) Basically, using an extension, I wrap all resolvers in the There is still some more testing to do with it but I think it's the right approach. (I'm no longer contributing to Graphene but thought I'd share in case it helps 🙂 ) |
Data loaders that exist are not fully compatible with new versions of graphene and graphene-django. DjangoConnectionField doesn't seem to handle loaders correctly and instead return errors like: "Cannot return null for non-nullable field EmailNodeConnection.edges." So for now, data loaders will be disabled for this field type. Use graphql-sync-dataloaders to make other types of fields work with data loaders. Some GitHub issues for reference: - graphql-python/graphene-django#1394 - graphql-python/graphene-django#1263 - graphql-python/graphene-django#1425 Refs: HP-2082
Hi there!
Data loaders used to work with
graphene-django
, there is a perfectly maintained example of it here https://github.com/ngshiheng/django-graphene-starter .They don't work anymore after updating
graphene
andgraphene-django
to v3, even after following the new graphene docs here.According to these docs though, they seem to work in
graphene
v3, so the only thing left to do is makegraphene-django
compatible with that behaviour.It seems that there is work ongoing on trying to make it function again in
graphene-django
(#1256 and https://replit.com/@jkimbo/Graphene-async#main/schema.pyhttps://replit.com/@jkimbo/Graphene-async#main/schema.py @fabienheureux @jkimbo)I have two questions:
graphene-django
v3 really break this? I would really like to use DataLoader withgraphene-django
v3 as it is a much better solution thangraphene-django-optimizer
, but am stuck right now.PS: @syrusakbary, is this on your radar? The support of DataLoader with
aiodataloader
seems really nice but it's a big issue for the community if it works ingraphene
but not ingraphene-django
😅Thanks!
The text was updated successfully, but these errors were encountered: