I have found a different solution for this situation. For me, it was too complicated to make the data replacement in the @post_dump
method because of custom-calculated attributes in the schema. I have used the SQL Alchemy make_transient
function. To remove the modified object from the session. So no changes done to the object are reflected in the database. This way I can do any modification to the object and generate modified schema without the requirement to rewrite the whole @pre_dump
function.