Skip to content
Advertisement

Table get locked when called an SQL Server SP from pyodbc Python [closed]

Table get locked when called an SQL Server SP from pyodbc Python

I have a table I made for testing called test. I just want to see if my code works. My python code is very simple and only calls one SP

Here is my SQL Server SP script:

JavaScript

and my python code is this:

JavaScript

Before running the python code I ran this select

JavaScript

and the output was 4 records

I ran the python script and I got this output

JavaScript

which means record been inserted and total number of records is 5

but when I run the

JavaScript

I still get 4 records only

and when I try

JavaScript

I get timed out.

How to fix that?

Advertisement

Answer

read_sql won’t commit the transaction. You need to explicitly commit it.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement