我在sqlalchemy中有这样的模型声明:
class User(Model):
name: StringType = StringType(required=True)
age: IntType = IntType(required=True)
比我有方法,我想要从表中获取所有行,如下所示:
def get_users():
return UsersResponse(dict(
users=User.query.all()
))
UserResponse看起来像这样:
class UsersResponse(Model):
users: ListType = ListType(ModelType(User))
我收到此错误:
schematics.exceptions.DataError: {"users": {"0": ["Input must be a mapping or 'User' instance"], "1": ["Input must be...
有人可以帮助我解决此问题吗?