Python Forum
Database operation exception handling - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Database operation exception handling (/thread-15026.html)



Database operation exception handling - LostInCode - Dec-30-2018

Hi,
Do commit and rollback operations on a database need their own separate and specific try-exception blocks over and above any try-block used for a modifying query?
Ta.


RE: Database operation exception handling - jeanMichelBain - Jan-03-2019

I don't think so.
You can put your commit or rollback inside its own 'try' block to check if it ran correctly, or you can use the same 'try' for all the transactions sequence.