# HG changeset patch
# User Ian Hixson <ihixson@gearupsports.net>
# Date 1738353405 28800
# Fri Jan 31 11:56:45 2025 -0800
# Node ID e15ba0b278504b783698d28d653d80788ad86daf
# Parent e41b0a93a75022de74f845e97edebe2d6a3e032a
Fix ssl connections with mysql
The suggested uri to use for ssl connections to mysql is:
mysql://user:password@host:port/name?ssl=1&sslca=foo&sslcert etc.
the full list of optional ssl related arguments is here
https://ollycope.com/software/yoyo/latest/#mysql-connections
However, by premptively updating kwargs with dburi.args, we end up passing the
extra ssl related arguments to the underlying db driver (pymysql in our case)
which does not handle ssl arguments in the same way.
Here is an upstream ticket of the same issue with a different suggested solution
but they correctly identified the problem so credit goes to them.
https://todo.sr.ht/~olly/yoyo/61
diff --git a/yoyo/backends/core/mysql.py b/yoyo/backends/core/mysql.py
--- a/yoyo/backends/core/mysql.py+++ b/yoyo/backends/core/mysql.py
@@ -24,7 +24,6 @@
def connect(self, dburi):
kwargs = {"db": dburi.database}
- kwargs.update(dburi.args) if dburi.username is not None:
kwargs["user"] = dburi.username
if dburi.password is not None: