summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/provision.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-08-21 14:44:04 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-08-25 20:10:16 -0400
commit3668b3a30c4b9a9f4af13457f43bfc34c28cf448 (patch)
tree6be6b991de7f3eb06181fd045b003e1b6d7e250e /lib/sqlalchemy/dialects/mysql/provision.py
parent9b6b867fe59d74c23edca782dcbba9af99b62817 (diff)
downloadsqlalchemy-3668b3a30c4b9a9f4af13457f43bfc34c28cf448.tar.gz
make URL immutable
it's not really correct that URL is mutable and doesn't do any argument checking. propose replacing it with an immutable named tuple with rich copy-and-mutate methods. At the moment this makes a hard change to the CreateEnginePlugin docs that previously recommended url.query.pop(). I can't find any plugins on github other than my own that are using this feature, so see if we can just make a hard change on this one. Fixes: #5526 Change-Id: I28a0a471d80792fa8c28f4fa573d6352966a4a79
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/provision.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/provision.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/provision.py b/lib/sqlalchemy/dialects/mysql/provision.py
index bbe752d78..a1d82222d 100644
--- a/lib/sqlalchemy/dialects/mysql/provision.py
+++ b/lib/sqlalchemy/dialects/mysql/provision.py
@@ -1,5 +1,3 @@
-import copy
-
from ... import exc
from ...testing.provision import configure_follower
from ...testing.provision import create_db
@@ -9,7 +7,7 @@ from ...testing.provision import temp_table_keyword_args
@generate_driver_url.for_db("mysql", "mariadb")
-def generate_driver_url(url, driver, query):
+def generate_driver_url(url, driver, query_str):
backend = url.get_backend_name()
if backend == "mysql":
@@ -17,10 +15,9 @@ def generate_driver_url(url, driver, query):
if dialect_cls._is_mariadb_from_url(url):
backend = "mariadb"
- new_url = copy.copy(url)
- new_url.query = dict(new_url.query)
- new_url.drivername = "%s+%s" % (backend, driver)
- new_url.query.update(query)
+ new_url = url.set(
+ drivername="%s+%s" % (backend, driver)
+ ).update_query_string(query_str)
try:
new_url.get_dialect()