You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
They don't work anymore after updating graphene and graphene-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 make graphene-django compatible with that behaviour.
Is my diagnostic right or have I missed something? Did graphene-django v3 really break this? I would really like to use DataLoader with graphene-django v3 as it is a much better solution than graphene-django-optimizer, but am stuck right now.
Is the work on solving the issue ongoing, and if yes do you have an approximative ETA? This is quite critical for our business 😬 I would be really happy to help on this issue if needed! 🙂
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 in graphene but not in graphene-django 😅
Thanks!
The text was updated successfully, but these errors were encountered:
@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 sync_to_async decorator and that lets me use the Django ORM in an async context. Also by wrapping the dataloader load fn in the sync_to_async decorator I can get async dataloader to work.
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
Uh oh!
There was an error while loading. Please reload this page.
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: