Skip to content

Is there any way to get select_related to work? #197

Closed
@camd

Description

@camd

I can't seem to get select_related to be honored at all, in my experience. Can anyone help me identify how it should work?

Job has a foreign keys to Push and to FailureClassification models.
Here's my Graphene Schema:

class PushGraph(DjangoObjectType):
    class Meta:
        model = Push
        filter_fields = ('revision', )
        interfaces = (graphene.relay.Node, )

    jobs = DjangoFilterConnectionField(JobGraph)

    def resolve_jobs(self, args, context, info):
        return (Job.objects
            .filter(push=self, **args)
            .select_related("failure_classification")
        )

This seems to have no effect on doing a join in the queries. I get tons of repeat queries for each Job that's returned. Is this a bug? Or a result of using DjangoFilterConnectionField? as mentioned in Issue 179?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions