I try to use python/pyodbc to insert data to a table:
import pyodbc
conn=pyodbc.connect('Driver={ODBC Driver 17 for SQL Server};'
'Server=' + server + ';'
'Database=' + database + ';'
'Trusted_Connection=yes;')
cursor=conn.cursor()
query = f'insert into {table} (col1, col2) values (3, 4)'
cursor.execute(query)
conn.commit() # I forgot to add this
I forgot to add the commit step, then the table is hanging. If I run a select query from the table separately, the query is hanging. Is there anyway I can reset the table? I am also using the MS SQL Studio.