I was hoping someone could help me with a certain issue...
Here's a sample of a funtion I have:
from pyodbc import connect
from pandas import read_sql
conn = connect('Driver={SQL Server};SERVER=Server_Name;DATABASE=Database_Name;Trusted_Connection=Yes', autocommit=True)
current_date = datetime.now().date().strftime("%Y-%m-%d")
query1 = f"exec [dbo].[Stored_Precedure_Name] @param1 = 1, @param2= N'{current_date}'"
df = read_sql(query1, conn)
The problem is that this reqest takes about 7 minutes to load. But if I execute it in SSMS, it only takes a few seconds to load.
I have no idea why it takes Python so long to load compared to SSMS. Does anybody know why is it so? Any ideas appreciated.