PyMySQLLock
MySQL Backed Locking Primitive
Decision gist · record as of 2026-08-14
No. The package is abandoned (last release 2020-09-13, no maintenance since) and classified as pre-alpha. While the concept is sound and the MIT license is permissive, the lack of updates means no fixes for bugs, compatibility issues with modern Python or MySQL versions, or security concerns. Consider a maintained alternative like a Redis-based lock library or a purpose-built distributed coordination tool unless you have a very stable, isolated deployment and can accept the risk of no future support.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires an active MySQL connection; the package works with PyMYSQL, mysql-connector-python, or mysqlclient but does not include or install any MySQL driver itself.
- Installation is straightforward with no runtime dependencies.
- However, the package is abandoned—last release was 2020-09-13 with no commits or maintenance signals since.
License · maintenance · safety
MIT license (permissive) — MIT license permits commercial and private use with minimal restrictions, requiring only license and copyright notice retention.
last release 2020-09-13 (2161 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 255,021 downloads/mo, #8,485 on PyPI
Alternatives
Verify before relying
pip install PyMySQLLock
from PyMySQLLock import Locker
locker = Locker(host="localhost", user="root", password="password", database="db")
lock = locker.lock("lock_name")
lock.acquire(timeout=10)
# do something
lock.release()- Whether the package works reliably with modern MySQL versions and current Python 3.9+ releases beyond the declared support for 3.6–3.8.
- Whether background connection refresh (ping interval) is sufficient to prevent connection timeouts in production environments.
- Performance characteristics and scalability limits when many application instances contend for locks on a single MySQL database.
What it is and what it does
PyMySQLLock wraps MySQL's GET_LOCK function to provide a simple distributed locking mechanism for coordinating work across multiple Python application instances that share a common MySQL database. Instead of adding external systems like Zookeeper or etcd, it leverages your existing MySQL infrastructure to ensure only one instance holds a lock at a time and can execute protected tasks.
The package exposes a Locker class that takes standard MySQL connection parameters, then creates named Lock objects that can be acquired with optional timeouts and released when done. It maintains the lock by periodically pinging the MySQL connection in the background to prevent idle disconnection. You can also query all currently held locks on the database.
Use it for
- Coordinate scheduled job execution across multiple application servers so only one instance runs a critical task at a time.
- Prevent race conditions when multiple instances need exclusive access to a shared resource managed through MySQL.
- Implement leader election or primary-replica coordination in a cluster without deploying additional infrastructure.
- Serialize access to database operations that cannot tolerate concurrent modification from multiple application instances.
- Gate one-time initialization or migration tasks that should run exactly once across a fleet of servers.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
No.
The package is abandoned (last release 2020-09-13, no maintenance since) and classified as pre-alpha. While the concept is sound and the MIT license is permissive, the lack of updates means no fixes for bugs, compatibility issues with modern Python or MySQL versions, or security concerns. Consider a maintained alternative like a Redis-based lock library or a purpose-built distributed coordination tool unless you have a very stable, isolated deployment and can accept the risk of no future support.
Install
pymysqllock on PyPI
Before you install
Installation is straightforward with no runtime dependencies. However, the package is abandoned—last release was 2020-09-13 with no commits or maintenance signals since. Use only if you accept the risk of unpatched issues and no future updates.
Requires an active MySQL connection; the package works with PyMYSQL, mysql-connector-python, or mysqlclient but does not include or install any MySQL driver itself.
License in practice
MIT license permits commercial and private use with minimal restrictions, requiring only license and copyright notice retention.
Quickstart
pip install PyMySQLLock
from PyMySQLLock import Locker
locker = Locker(host="localhost", user="root", password="password", database="db")
lock = locker.lock("lock_name")
lock.acquire(timeout=10)
# do something
lock.release()
Verify before relying
- Whether the package works reliably with modern MySQL versions and current Python 3.9+ releases beyond the declared support for 3.6–3.8.
- Whether background connection refresh (ping interval) is sufficient to prevent connection timeouts in production environments.
- Performance characteristics and scalability limits when many application instances contend for locks on a single MySQL database.
Package facts
| License | MIT license permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 2,161 days since the last release |
| First released | |
| Downloads | 255,021 / month, #8,485 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8 |
Evidence: PyMySQLLock-0.2.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “mysql distributed lock”
- PyMySQLLockProvides distributed locking primitives backed by MySQL's GET_LOCK…
- python-redis-lockProvides a Redis-backed distributed lock with a threading.Lock-like…
- django-mysqlDjango-MySQL extends Django's ORM with MySQL and MariaDB-specific…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also python-dynamodb-lock · redlock-py · python-redis-lock · aiorwlock · redlock · locket · zc.lockfile · etcd-sdk-python · django-pglock · django-pglocks