Author :⠀ Martin Zhang Created :⠀ 03/28/2021, 237 PM ET Modified :⠀ Version :⠀ 1.0 Purpose :⠀ Use Python3 and the PyMySQL module to interact with MySQL. Comments :
Make sure MySQL is running.
The Python code uses Python3.
- You may need to change:
#!/usr/bin/python3
for other versions.The Python code utilizes the PyMySQL module.
- You will need to install this module if it's not already available on your system.
- To install, run the command in the Terminal:
pip3 install PyMySQL
In my case the PyMySQL module is installed at:
/usr/local/lib/python3.9/site-packages/
- You may need to change the path on your system
/YourSystemPath/../pymysql
The entries in each row are connected by a space. (You may use other text delimiters.)
- Edit the space between the single-quotes in
print(' '.join(map(str, row)))
Set the database Name, User, Password, and the Command in the KM variables (orange color).
Download ⇢ MySQL - Python.kmmacros (8.7 KB)