Python Forum

Full Version: Weird SQLAchemy connection string error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I have a piece of python code running flask with the following connection string and using SQLAchemy to connect to a MySQL DB running in Azure public cloud.

SQLALCHEMY_DATABASE_URI = 'mysql://username:[email protected]:3306/flaskdb'
Everything works fine if I run the python code on my local computer, I am able to access the MySQL database and it's contents. However, when I try to deploy the same code to an Azure Web App service, which is a PaaS platform for code deployment, I get the following error
Error:
2020-06-28T09:53:10.355423645Z: [ERROR] sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (9002, 'The connection string may not be right. Please visit portal for references.') 2020-06-28T09:53:10.355427245Z: [ERROR] (Background on this error at: http://sqlalche.me/e/e3q8)
I have been trying to troubleshoot by playing around with the connection string but to no avail. I do not think the connection string is incorrect as I don't encounter errors running it locally. Wonder if anyone who is familiar with this can provide me with some advice. Thanks!