Installation
pip install easymysql # MySQL only
pip install easymysql[postgres] # PostgreSQL as well
If your system pip points at Python 2, use pip3.
Requirements
- Python 3.9 or newer. Tested on 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14.
- MySQL or MariaDB for the
mysqlbackend. - PostgreSQL for the
postgresqlbackend.
The PostgreSQL extra
The base install brings PyMySQL only. The [postgres] extra
adds psycopg2-binary.
Without the extra, import easymysql.postgres raises
ImportError. The MySQL backend works either way.
Upgrading from 0.1.9
0.2.0.0 breaks compatibility — see Migrating from 0.1.9.
Checking the installed version
import easymysql
easymysql.__version__ # '0.2.0.0'
version() on a connection returns the library version, not
the server's. For the engine, run db.query('SELECT VERSION()').