'Python - SQLAlchemy Engine cannot connect

I am using sqlalchemy and pyodbc to connect to my SQL Server.

pyodbc version == 4.0.30
sqlalchemy version == 1.4.19

This used to work fine in the past but it just stop working giving me the following error:

InterfaceError: (pyodbc.InterfaceError) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') (Background on this error at: http://sqlalche.me/e/14/rvf5)

This is the code that I am using:

sql_engine = sqlalchemy.create_engine(
    'mssql+pyodbc://{SERVER NAME}/{DB NAME}?driver=SQL Server?Trusted_Connection=yes'
                                     ).connect()

As I said this used to work perfectly but it just stopped.

Any ideas why that might be the case and how I can trace back to what is causing the above error?

Really would appreciate all the help I can get.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source