class Node(db.Model):

    def update(self, **kwargs):
        for key, value in list(kwargs.items()):
            setattr(self, key, value)


class NodeAPI(MethodView):
    decorators = [login_required]
model = Node

def get_queryset(self):
    if g.user.is_admin:
        return self.model.query
return self.model.query.filter(self.model.owner == g.user)

def put(self, node_id):
    json_data = request.get_json()
if not json_data:
    abort(400)
data, errors = node_schema.load(json_data)
if errors:
    return jsonify(errors), 422
queryset = self.get_queryset()
node = queryset.filter(self.model.id == node_id).first_or_404()
node.update(**data)
db.session.commit()
return jsonify(message='Successfuly updated'), 200
Update row (SQLAlchemy) with data from marshmallow