Installation

pip install easymysql              # MySQL only
pip install easymysql[postgres]    # PostgreSQL as well

If your system pip points at Python 2, use pip3.

Requirements

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()').