ORMにElixirを使用していますが、関係で注文しようとすると問題が発生します。
私がやろうとしているのは、投稿数でソートされたユーザーのリストを取得することです。私は次のような方法を試しました
User.query.join(User.posts).order_by(func.count(User.posts)).all()
成功せずに。
これが私のElixirエンティティです:
class User(Entity):
username = Field(Unicode(100))
posts = OneToMany('Post', inverse='user')
class Post(Entity):
content = Field(Unicode(20000))
user = ManyToOne('User')