Python Forum

Full Version: Connecting to MySQL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

Just wondering what the best way to connect and query an external MySQL database is.

I have found a few different options, some of which look very outdated.

Thanks.
MySQL Connector seems like a good choice to me, but there are others too. The only one I found to be considered outdated is MySQLdb, but even this one has some forks which get some attention.

I would assume you are tied to MySQL, but if you have a chance I suggest considering Postgres too.
SQLAlchemy's MySQL support lists several drivers that work, including which haven't had any development in a while, and which ones only work on python 2.x vs 3.x.
(Oct-04-2016, 06:18 PM)nilamo Wrote: [ -> ]SQLAlchemy's MySQL support lists several drivers that work, including which haven't had any development in a while, and which ones only work on python 2.x vs 3.x.
I see PyMysql on list,but not link to GitHub it's a pure-Python MySQL client library.
If use Framework there are usually own connection made for this eg Flask-MySQLdb’s,  Flask-MySQL
Thank-you everyone. I have gone with PyMySQL as it's compatible with the ARM processor in my Pi3 and seems to be maintained unlike some of the other options.