I am trying to execute stored procedure from data bricks by using PYODBC connection, after all transactions happened, status is going to sleep mode. Please help me on that, I tried all the possibilities auto-commit and connection timeout etc. but nothing is working.
import pyodbc
import datetime
username = "usrname"
password = "password"
server = "server"
database_name = "dbname"
port = "1433"
conn=pyodbc.connect('Driver={ODBC Driver 17 for SQL server};SERVER=tcp:'+server+','+port+';DATABASE='+ database_name +';UID='+ username +';PWD='+ password)
#conn.timeout = 600
cursor=conn.cursor()
# conn.autocommit = True
sql = "set nocount on; exec proc_name"
print("Connection Started at "+str(datetime.datetime.now()))
cursor.execute(sql)
print("Connection closed at "+str(datetime.datetime.now()))
conn.commit()
cursor.close()
conn.close()
print(datetime.datetime.now())
Notebook is still in Running process please have a look on below pic
Status from database for that SPID initially status is RUNNABLE once all transaction got completed from proc(insertion, delete, update of data) status is updating as sleeping mode
because of this sleeping status data bricks note book is not completing, it's keep on running. please help me out from issue. Thanks in Advance.