Deprecate mysqlclient/MySQLdb connector support (#655)

* Deprecate mysqlclient/MySQLdb connector support

* Update README

* Put in README that mysqlclient is deprecated
This commit is contained in:
Andrew Klychkov 2024-07-09 08:20:47 +02:00 committed by GitHub
parent 4912f1a41b
commit 83ed4af4e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 21 deletions

View file

@ -154,6 +154,13 @@ def mysql_connect(module, login_user=None, login_password=None, config_file='',
db_connection = mysql_driver.connect(autocommit=autocommit, **config)
else:
# In case of MySQLdb driver
# Will be deprecated and dropped
# https://github.com/ansible-collections/community.mysql/issues/654
module.warn('Support of mysqlcline/MySQLdb connector is deprecated. '
'We\'ll stop testing against it in collection version 4.0.0 '
'and remove the related code in 5.0.0. Use PyMySQL connector instead.')
if mysql_driver.version_info[0] < 2 or (mysql_driver.version_info[0] == 2 and mysql_driver.version_info[1] < 1):
# for MySQLdb < 2.1.0, use 'db' instead of 'database' and 'passwd' instead of 'password'
if 'database' in config: