Optimize Django SQL queries based on the GraphQL queries fields#67
Optimize Django SQL queries based on the GraphQL queries fields#67syrusakbary wants to merge 9 commits intomasterfrom
Conversation
Conflicts: graphene/core/schema.py
graphene/contrib/django/fetcher.py
Outdated
There was a problem hiding this comment.
This function seems useful outside Django, to get the fields from an info object. Is there any way this could be refactored into graphene core? I'm willing to do the work, but I'm not familiar enough with the codebase to know where this should fit.
Update: I'm looking into whether this can be directly added to the ResolveInfo class in graphql-core. It seems the most logical place for this to go.
There was a problem hiding this comment.
Good catch @bigblind - that would be great to have in graphene core/ResolveInfo
1c3c511 to
7be53fa
Compare
Conflicts: graphene/contrib/django/converter.py graphene/contrib/django/fields.py graphene/contrib/django/tests/test_converter.py
7be53fa to
6e3fe9c
Compare
|
My understanding is that See the documentation for only and defer, the note pretty much says "don't do this unless you absolutely have to". |
phalt
left a comment
There was a problem hiding this comment.
Should this be part of graphene-django and not graphene? This PR is very old, so it's probably worth re-implementing from scratch.
|
@phalt this is when django was under graphene.contrib.django :) I the faq / upgrading it was moved in v1.0 to a seperate package |
|
@ProjectCheshire guess we can close it then! |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
As GraphQL provides a way for fetching only certain fields, the Django mapper should adapt for querying only what is requested. That means using
model.objects.only(*requested_fields)as will be much more performant.