Skip to content
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

Fix Relay Connection ID #56

Merged
merged 1 commit into from
Nov 8, 2020
Merged

Conversation

iorlandini
Copy link
Contributor

The issue

The only optimization is being aborted when using the GlobalID as expected in Relay.

Example

Given:

from django.db import models
from graphene import relay
from graphene_django_optimizer import OptimizedDjangoObjectType


class Customer(models.Model):
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)


class CustomerType(OptimizedDjangoObjectType):
    class Meta:
        model = Customer
        name = "Customer"
        interfaces = (relay.Node,)


class Query(graphene.ObjectType):
    customers = OptimizedConnectionField(CustomerType)

And performing:

{
    customers {
        edges {
            node {
                id
            }
        }
    }
}

The following query is executed:

SELECT
    "customer_customer"."id",
    "customer_customer"."first_name",
    "customer_customer"."last_name",
FROM
    "customer_customer";

Expected:

SELECT
    "customer_customer"."id"
FROM
    "customer_customer";

@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2020

Codecov Report

Merging #56 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   93.73%   93.76%   +0.03%     
==========================================
  Files           6        6              
  Lines         319      321       +2     
==========================================
+ Hits          299      301       +2     
  Misses         20       20              
Impacted Files Coverage Δ
graphene_django_optimizer/query.py 92.27% <100.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 760676e...5ff4689. Read the comment docs.

@iorlandini
Copy link
Contributor Author

Hi @tfoxy, any chance to get this reviewed?

@tfoxy tfoxy merged commit fb23258 into tfoxy:master Nov 8, 2020
@tfoxy
Copy link
Owner

tfoxy commented Nov 8, 2020

Thanks for taking time for this. v0.7.1 released with this fix! Sorry it took so long.

@iorlandini
Copy link
Contributor Author

Thanks for taking time for this. v0.7.1 released with this fix! Sorry it took so long.

Do not worry about the delayed answer, also, thank you for writing the module in the first place. Anyway, I have been using my own fork.

On the other hand, I created another PR to fix another issue #57. Again, I'm using it from my own fork. But I think it would be good to fix it in this repository as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants