[1] I find it odd that one of the new blocks catches both (OperationalError, DatabaseError), and the other catches only OperationalError. Shouldn't they both catch the same exception.
[2] Additionally, a try: except: else is being used, which means that if by any chance a different exception is raised other than the ones that are being catched the cursor will not be closed. I would change that to try: (try: except: pass) finally: cursor.close() instead.
+1 with those changes done, or a good justification. :)
[1] I find it odd that one of the new blocks catches both (OperationalError, DatabaseError), and the other catches only OperationalError. Shouldn't they both catch the same exception.
[2] Additionally, a try: except: else is being used, which means that if by any chance a different exception is raised other than the ones that are being catched the cursor will not be closed. I would change that to try: (try: except: pass) finally: cursor.close() instead.
+1 with those changes done, or a good justification. :)