-
Notifications
You must be signed in to change notification settings - Fork 83
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
prefetch relay children - duplicate issue of #1, #4, etc. #17
Comments
I think I am 1 step closer to identify the issue. I put some breakpoints on my code. Seem like the custom Is this normal? We know the culprit may be below if iterable is not default_manager:
default_queryset = maybe_queryset(default_manager)
iterable = cls.merge_querysets(default_queryset, iterable) Is this supposed to be never run, or this will break the prefetch cache? Not sure why this is the case though, need some more investigation... |
Problem solved? Subclassing was indeed too much trouble, I just had to directly modify the below code of Graphene, and prefetch did work as expected... But in the long run, still I would prefer to do this through subclassing. class DjangoConnectionField(ConnectionField):
@classmethod
def merge_querysets(cls, default_queryset, queryset):
return queryset |
Can you tell me which version of python and django are you using? If you have the time, can you do a PR with a test that fails in this case? |
We are also experiencing the same issues. It appears that edges are not auto prefetched. The following query for example results in an extra query per To-Do. Expected result would be to prefetch all
Tested in Python 3.7, Django 2.1 and 2.2 |
@tfoxy I know an instance where So I am guessing there must be some compatibility problem with Also there is this new https://docs.graphene-python.org/en/latest/execution/dataloader/ I wonder if anyone has successfully deployed this new approach. Also meanwhile the more I browse for |
@gotexis We are using regular |
@gotexis I believe this is fixed in the latest release. |
I am having a similar problem, nested relations with filters produce more queries. |
Hey, I guess something is wrong with my setup, perhaps not even related to graphene-django-optimizer.
I have exactly the same issue with #1
I have used all solutions I can see from Graphene and here, plus that I am even manually calling
prefetch_related('children_set')
, queries will still be N+1.Here's my model.
Overridding DjangoConnectionField to not use
merge_querysets
, like suggested:#429
Schema
And the query
just for sanity check, python query does work:
Now, this result in N+1... Driving me crazy :(
Hope you don't mind me calling for help here @maarcingebala :) Your Saleor repo was the original inspiration that I used the Graphene stack.
please help me fellow python gods
The text was updated successfully, but these errors were encountered: