0

我试图弄清楚如何在 GraphQL 的子表中接受参数和查询该字段。

这是一个例子。

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

这是我用来查询数据的。它可以查询数据,除了我希望能够传递一个参数来搜索特定的例如 featureVectors(featureSize: 128)。我似乎在 Graphene-SQLAlchemy 库中找不到任何本机允许这样做的东西。

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 = SQLAlchemyConnectionField(ModelConn)
4

0 回答 0