James Briggs
1 min readMay 22, 2020

--

We can close the connection by deleting the connection object, del cnxn in this case. Otherwise the connection will close either on exception or code completion.

Additionally, cursor.commit() commits the active transaction.

Using both of these together should be sufficient, or at least it has been in my experience.

It’s a very good question, and I think I may go and read a little more on this soon, thanks for bringing it up!

--

--

James Briggs
James Briggs

Written by James Briggs

Freelance ML engineer learning and writing about everything. I post a lot on YT https://www.youtube.com/c/jamesbriggs

No responses yet