Skip to content

Add mysqlclient as additional library supported in documentation #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
imjoseangel opened this issue Nov 5, 2020 · 12 comments · Fixed by #57
Closed

Add mysqlclient as additional library supported in documentation #56

imjoseangel opened this issue Nov 5, 2020 · 12 comments · Fixed by #57

Comments

@imjoseangel
Copy link
Contributor

SUMMARY

All the modules specify PyMySQL or MySQLdb options but to manage a multiplatform (Linux and Mac) environment, the best working option is mysqlclient. Recommended to add it as an option.

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

mysql_db
mysql_info
mysql_query
mysql_replication
mysql_user
mysql_variables

ANSIBLE VERSION
ansible 2.10.3
  config file = /Users/imjoseangel/source/sandbox/ansible.cfg
  configured module search path = ['/Users/imjoseangel/source/sandbox/library']
  ansible python module location = /Users/imjoseangel/.pyenv/versions/3.7.9/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible
  executable location = /Users/imjoseangel/.pyenv/versions/3.7.9/bin/ansible
  python version = 3.7.9 (default, Oct 20 2020, 13:13:36) [Clang 12.0.0 (clang-1200.0.32.2)]
@imjoseangel imjoseangel changed the title Add mysqlclient as additional library supported in documentation Add mysqlclient as additional library supported in documentation Nov 5, 2020
@Andersson007
Copy link
Collaborator

@imjoseangel hi, thanks for reporting this!
Could you please explain what do you mean (better with exaples)?

@imjoseangel
Copy link
Contributor Author

Thanks @Andersson007

For Mac and Linux: When using PyMySQL:

TASK [Get MySQL version with non-default credentials] *************************************************************
Thursday 05 November 2020  11:57:28 +0100 (0:00:00.107)       0:00:00.107 *****
fatal: [localhost]: FAILED! => changed=false
  msg: 'unable to connect to database, check login_user and login_password are correct or /Users/imjoseangel/.my.cnf has the credentials. Exception message: (2003, "Can''t connect to MySQL server on ''192.168.0.1'' ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: IP address mismatch, certificate is not valid for ''192.168.0.1''. (_ssl.c:1091))")'

When using mysqlclient:

TASK [Get MySQL version with non-default credentials] *************************************************************
Thursday 05 November 2020  12:03:19 +0100 (0:00:00.105)       0:00:00.105 *****
ok: [localhost] => changed=false
  version:
    major: x
    minor: x
    release: x

What I mean is that adding mysqlclient as the third option in the documentation is a good thing and it works.

What do you think?

@Andersson007
Copy link
Collaborator

@imjoseangel do you mean adding https://pypi.org/project/mysqlclient/ as the third connector or this can be used instead of MySQLdb transparantly and we just need to add a note to the documentation that people can install and use it instead?
i'm asking because i don't use it.
Thanks!

@imjoseangel
Copy link
Contributor Author

@Andersson007 I was thinking on adding as the third connector but currently is the best option also for Python2. Thinking in your question I would change MySQLdb by mysqlclient and keep this last one as the option compatible with Python2 (Tested) and Python3.

What do you think?

@Andersson007
Copy link
Collaborator

@imjoseangel if we replace it, won't this break systems where users have only MySQdb installed?

@Andersson007
Copy link
Collaborator

https://pypi.org/project/mysqlclient/ refers to MySQLdb documentation as i can see. Do we need to change the source code or we can just add a not that people can install mysqlclient instead of mysqldb to work with Python3 as well as with Python2 ?

@imjoseangel
Copy link
Contributor Author

Is just a change in the documentation, we don't need to change the source to work with the three libraries.

@Andersson007
Copy link
Collaborator

@imjoseangel that's ok:) i could add the note tomorrow (or maybe you want to do it yourself?)

@imjoseangel
Copy link
Contributor Author

@Andersson007 Is it here isn't it? Could you send me the meeting details? Thank you!

@Andersson007
Copy link
Collaborator

@imjoseangel i'm afraid we don't have regular meetings here:)
There are maybe 2 active maintainers (including me).
If you want to discuss this topic, all people interested in supporing this repo are currently subscribed to it

@imjoseangel
Copy link
Contributor Author

@imjoseangel that's ok:) i could add the note tomorrow (or maybe you want to do it yourself?)

Could you please specify what do you mean with adding the note? Do you mean create a PR for the documentation? If so, let me do this afternoon.

Thank you!

@Andersson007
Copy link
Collaborator

@imjoseangel ok, thanks! i'd suggest adding something like this

 81    - Alternatively, you can use the mysqlclient connector instead of MySQL-python (MySQLdb)
 82      which supports both Python 2.X and Python >=3.5.
 83      See U(https://pypi.org/project/mysqlclient/) how to install it.

to note: section of plugins/doc_fragments/mysql.py right after existing

 76 notes:
 77    - Requires the PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) package installed on the remote host.
 78      The Python package may be installed with apt-get install python-pymysql (Ubuntu; see M(ansible.builtin.apt)) or
 79      yum install python2-PyMySQL (RHEL/CentOS/Fedora; see M(ansible.builtin.yum)). You can also use dnf install python2-PyMySQL
 80      for newer versions of Fedora; see M(ansible.builtin.dnf).

just a suggestion, hope it'll help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants