i implemented in my flask api rest app, this code to get the use from id into database:
@blp.route("/v0/user/<int:id>")
class User(MethodView):
@blp.response(200, UserSchema)
def get(self, id):
user = UserModel.query.get_or_404(id)
return user
now i want to implement the same logic to get only user passing uuid_user that is a value of model user and is in my database, using this code:
@blp.route("/v0/user_uuid/<string:uuid_user>")
class UserUuid(MethodView):
@blp.response(200, UserSchema)
def get(self,uuid_user):
user = UserModel.query.filter(uuid_user).all()
return user
but i receive this error when i call the endpoint of this api:
File "/app/resources/user.py", line 150, in get
user = UserModel.query.filter(uuid_user).all()
File "<string>", line 2, in filter
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/base.py", line 248, in _generative"
Any help how to fix it? Where is the error? Thanks