Skip to content

Queries become unwieldy for larger graphql schemas #5

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

Closed
AdrielVelazquez opened this issue Dec 4, 2015 · 5 comments
Closed

Queries become unwieldy for larger graphql schemas #5

AdrielVelazquez opened this issue Dec 4, 2015 · 5 comments

Comments

@AdrielVelazquez
Copy link

I'm utilizing epoxy for sqlalchemy models, which is working out very well; however, when attempting to separate out the models an issue arises with inheritance.

class QueryMixin(R.ObjectType):
    field1 = R.String
    field2 = R.Integer


Class Query(QueryMixin):
    pass #or possibly have another field

When you create a situation like this, Query doesn't have any of the parameters of QueryMixin and thus the execution fails when creating a schema.

I propose a better handling of inheriting mixins. This may be a circumstance of graphql-core not handling inheritance first.

@syrusakbary
Copy link

@AdrielVelazquez have you taken a look into graphene? The inheritance/types is handled a little bit different, and the bug you're exposing is already solved

PS: GraphQL-epoxy is a great package too! Use the one you feel more comfortable with
PS2: SQLAlchemy automatic mapping will come to graphene soon :)

@AdrielVelazquez
Copy link
Author

I'm trying to look in graphene the equivalent of the following

@R.Field.CanBe
class RandomClass(object):
    #Random attributes

But I can't seem to find it. Does graphene have support for normal classes?

@syrusakbary
Copy link

I'm certainly confident that you would not need the canBe decorator in graphene.
Just return the instance whenever you're using it.
If that doesn't work... open an issue in the graphene project and I will solve it ASAP :)

@jhgg
Copy link
Collaborator

jhgg commented Dec 6, 2015

Hmm. Mixin support is something I can do @AdrielVelazquez.

@jhgg
Copy link
Collaborator

jhgg commented Dec 6, 2015

I've implemented it as such:

class NameMixin():
    name = R.String

class Dog(R.ObjectType, DogMixin):
    breed = R.String

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

No branches or pull requests

3 participants