I get a db record as an sqlalchemy object and I need to consult the original values during some calculation process, so I need the original record till the end. However, the current code modifies the object as it goes and I don't want to refactor it too much at the moment. 
How can I make a copy of the original data? The deepcopy seems to create a problem, as expected. I definitely prefer not to copy all the fields manually, as someone will forget to update this code when modifying the db object.
You can have many options here to copy your object.Two of them which I can think of are :

Using __dict__ it will give the dictionary of the original sqlalchemy object and you can iterate through all the attributes using .keys() function which will give all the attributes.
You can also use inspect module and getmembers() to get all the attributes defined and set the required attributes using setattr() method.
how to make a copy of an sqlalchemy object (data only)