aces / Loris-MRI

The set of scripts that preprocess and insert MRI data into the database.
10 stars 51 forks source link

Remove mysql-connector dependency #1200

Closed maximemulder closed 1 month ago

maximemulder commented 1 month ago

While testing #1150, @cmadjar encountered an issue when connecting to the database through SQLAlchemy. I suspect this is because this connection is using a deprecated version of mysql-connector. This dependency was already present in LORIS-MRI before adding SQLAlchemy although it was unused, and I wrongfully used it for the SQLAlchemy connection not knowing the version we had was deprecated (the non-depecrated version is mysql-connector-python.).

Solution: Remove the mysql-connector dependency and use mysqlclient instead, which is the client we use for the non-SQLAlchemy database connection.

P.S. 1: I manually recreated my virtual environment to make sure the dependency was completely removed, but it was detected by git, so I added the directory the gitignore, I have no idea why it was ignored before.

P.S. 2 : Some whitespace auto-trimming, ignore whitespaces in review.

P.S. 3 : Added quote() to escape the username and password of the use (the database and host should not have special characters).

Notes for existing projects