I am trying to run a simple SQL Server update script through Python pyodbc but when executing the python script, it's not making the update for some reason and I can't find the cause as it does not give any error message either. Below is my code sample:
import pyodbccnxn = pyodbc.connect("Driver=X;""Server=X;""Database=X;""UID=X;""PWD=X;""trusted_connection=yes;")cursor = cnxn.cursor()script = """ ;with cte as ( SELECT ID FROM table1 WHERE column1 IS NOT NULL ) UPDATE table2 SET column2 = 'value' WHERE column3 IN (SELECT ID FROM cte)"""cursor.execute(script)cnxn.commit()cursor.close()cnxn.close()