MySQL for Python,
the easy way

EasyMySQL lets you insert, query, update, and delete records
with a single method call and a plain Python dictionary.

Total downloads Monthly downloads Weekly downloads

Install

pip install easymysql

Why EasyMySQL?

Simple API

Four methods cover everything: insert, select, update, delete. No ORMs, no magic.

Dict-based queries

Pass plain Python dictionaries instead of hand-writing SQL strings. Use a raw string when you need full control.

Zero boilerplate

No cursor management, no manual commits, no connection pooling setup. Just connect and go.

Drop-in ready

Works alongside any Python framework — Flask, Django, FastAPI, or plain scripts.

See it in action

from easymysql.mysql import mysql

db = mysql('localhost', 'root', 'secret', 'shop')

# Insert
db.insert('products', {'name': 'Laptop', 'price': 999.99, 'stock': 50})

# Query
products = db.select('products', "price < 500", order='ORDER BY price ASC')
for p in products:
    print(p['name'], p['price'])

# Update
db.update('products', {'stock': 49}, {'name': 'Laptop'})

# Delete
db.delete('products', {'stock': 0})
Read the docs

Maintained by Alvaro De Leon