I'm using pyodbc (in an airflow task python callable) to connect to a database via airflow (running in docker). DSN gets connection args from an odbc.ini file within the docker container.
conn = pyodbc.connect(DSN=DSN_NAME, autocommit=True)
...some code to execute SQL statement
conn.close()
When I run it via CLI test it works fine
airflow tasks test dag_name task_name 2022-1-3
However, when I run it via the Airflow UI (in localhost) it seems the data source can't be found:
pyodbc.InterfaceError: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')
Why would the DSN reference work fine in testing but not via the localhost UI instance?