[Flask] Connecting to 2 servers

Larry Martell larry.martell at gmail.com
Fri Aug 9 15:09:48 EDT 2019


I have a flask app I inherited. It connects to a MySQL server and I
need to add a second connection to a MS SQL server.

The connection to the MySQL server was done like this:

engine = create_engine_from_str(connect_string)
factory = scoped_session(sessionmaker(bind=engine))
factory.configure(bind=engine)

I added a second connection:

m_engine = create_engine_from_str(m_connect_string)
m_factory = scoped_session(sessionmaker(bind=m_engine))
m_factory.configure(bind=m_engine)

But when I try any use the second connection it fails:

sqlalchemy.exc.InterfaceError: (pyodbc.InterfaceError) ('IM002',
'[IM002] [unixODBC][Driver Manager]Data source name not found, and no
default driver specified (0) (SQLDriverConnect)')

What am I doing wrong?


More information about the Flask mailing list