Skip to content

can I query with a field parameter on a subrelation #232

@vaskokj

Description

@vaskokj

I am trying to figure out how I can accept a parameter and query on that field in a sub table in a GraphQL query.

This is an example.

query{
  allModels{
    edges{
      node{
        featureVectors(featureSize: 128){ #I want to query on this
          edges{
            node{
              modelSize
              featureVectors
            }
          }
        }
      }
    }
  }
}

Here is that I'm using to query the data. It works to query the data, except that I would like to be able to pass a parameter to search for a specific for example, featureVectors(featureSize: 128). I can't seem to find anything in the Graphene-SQLAlchemy library to allow this natively.

class ModelModel(Base):
    __tablename__ = 'models'

    id = Column(Integer, primary_key=True, server_default=text("nextval('models_id_seq'::regclass)"))
    type = Column(Text)
    components = Column(Float)
    notes = Column(Text)
    feature_vectors = relationship("FeatureVector", back_populates='models')

class FeatureVectorModel(Base):

    id = Column(BigInteger, primary_key=True, server_default=text("nextval('feature_vectors_id_seq'::regclass)"))
    model_size = Column(Integer)
    feature_vectors = Column(ARRAY(Float(precision=53)))

    models = relationship('Model', back_populates='feature_vectors')

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


class ModelConn(relay.Connection):
    class Meta:
        node = Model


class Query(graphene.ObjectType):
    node = relay.Node.Field(schema_cadlearn.Model)
    all_models = SQLAlchemyCon

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