import pandas as pd
import pyodbc
import requests as rq
conn = pyodbc.connect("Driver={SQL Server};"
"Server=Servername;"
"Database=AVR;"
"Trusted_Connection=yes;")
df_kontrola = pd.read_sql_query("select ........'",conn)
conn.close()
del conn
....
send email
....
If I run the script in the Anaconda environment (Spyder 4, Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]. IPython 7.22.0 -- An enhanced Interactive Python. ) so the script will run fine, without any warning. (The station is not regularly updated and is offline (only intranet), administrators update Anaconda once every 3-4 months.)
But, if I run the script in due to user rights on the same station in the second python 3.9.5 as scheduled task "c:...\python.exe c:...\script.py".
I get this warning "UserWarning: pandas only supports SQLAlchemy connectable (engine/connection) or database string URI or sqlite3 DBAPI2 connection. Other DBAPI2 objects are not tested. Please consider using SQLAlchemy." and the task scheduler reports an error at startup.
And even if the script runs fine (an email with the result is sent at the end of the script).
How do I remove this warning so that the task scheduler doesn't report a startup error?