Reputation: 207
I have a python script to download files from an SFTP site to a local folder and then run a stored procedure using the downloaded file. The first aspect runs fine. But then the execution of the stored procedure causes a lock on other tables on the SQL server - returns "Timeout expired" error. The procedure has been running for an hour and half.
This is the syntax I used for the execution of the stored procedure in case anybody was wondering:
conn = pyodbc.connect('DRIVER={SQLServer};SERVER=localhost;DATABASE=Db;UID=myid;PWD=mypwd')
cursor = conn.cursor()
cursor.execute("""exec SP_Upsert_Y ?""",sfile)
cursor.commit()
Upvotes: 1
Views: 3226
Reputation: 65
i had the same problemn and y solved add the parameter autocommit=True
to connection string
Upvotes: 1