graphene-sqlalchemy

Order by query output column

杀马特。学长 韩版系。学妹 提交于 2020-08-24 03:47:06
问题 I'm using graphene with sqlalchemy and I have an output object that contains a computed field. The field is computed according to some input (query) parameter and more or less look like this (to simplify, lets consider I'm computing f(x)=ax+b where a and b are both columns in my Thing table): import models class Thing(SQLAlchemyObjectType): class Meta: model = models.Thing interfaces = (relay.Node, ) f = graphene.Field(graphene.Float) def resolve_f(self, info): return self.a * info.context['x