SQLAlchemy is autosaving the model objects when their attributes are being changed. Is there any way of disabling this and only save it when I need it?
I know there is a expunge function which detaches object model and therefore it won't be updated, but then i cannot access objects relations.
Try setting autoflush of your session to False:
session.autoflush = False
This way your changes will not be communicated to the database until you call
session.flush()
and will not be committed until you call
session.commit()
Further information about transaction management can be found in the docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With