I have the example code below. Do I still need a cursor commit after the last line? I am running against a SQL server 2016 DB host if that matters.
import pyodbc
cnxn = pyodbc.connect('Driver=SQL Server;Server=localhost;Database=mydb;Trusted_Connection=yes;')
cnxn.autocommit = True
cursor = cnxn.cursor()
cursor.execute('update mytable set myfield=1')
CodePudding user response:
No, you don't need to do the cursor.commit()
cnxn.autocommit = True
This line in your code will commit all your transactions to the SQL