3

I'm using graphene_sqlalchemy package in my Flask app (https://github.com/graphql-python/graphene-sqlalchemy) and I need to make two queries using the same Model. I was wondering if is possible two types share the same model as bellow:

class A(SQLAlchemyObjectType):
    x = graphene.Int()

    class Meta:
        model = Model
        interfaces = (graphene.relay.Node,)

class B(SQLAlchemyObjectType):
    y = graphene.Int()

    class Meta:
        model = Model
        interfaces = (graphene.relay.Node,)

or using inheritance:

class A(SQLAlchemyObjectType):
    x = graphene.Int()

    class Meta:
        model = Model
        interfaces = (graphene.relay.Node,)

class B(A):
    y = graphene.Int()

But I'm getting errors using these two aproachs. Is there any workaround for it? Thank you in advance !

Harrison Henri
  • 119
  • 1
  • 12

0 Answers0