alchemy-mock
SQLAlchemy mock helpers.
Decision gist · record as of 2026-08-14
Yes, but with caution. The package solves a real testing problem and has low install friction, but it is abandoned and has not been updated since 2021. Install it only if your SQLAlchemy and Python versions are compatible with its last release, and only if you are willing to maintain a fork or workaround if compatibility breaks. For new projects, consider actively maintained alternatives.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires SQLAlchemy to be installed; package is abandoned and may have compatibility issues with modern SQLAlchemy or Python versions.
- Low install friction with three lightweight runtime dependencies.
- However, the package is abandoned—last release was 2019-11-05 and last commit 2021-01-07.
License · maintenance · safety
MIT (permissive) — MIT license is permissive and poses no restrictions on use, modification, or distribution in commercial or private projects.
last release 2019-11-05 (2474 days) · last repo commit 2021-01-07 · 83 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 223,061 downloads/mo, #9,253 on PyPI
Alternatives
Verify before relying
pip install alchemy-mock
from alchemy_mock.mocking import UnifiedAlchemyMagicMock
session = UnifiedAlchemyMagicMock()
m = session.query(Model)
q = m.filter(Model.foo == 5)
data = q.all()- Compatibility with SQLAlchemy versions released after 2021-01-07 is not documented.
- Whether the package works with Python versions beyond 3.6 is unclear given the abandoned status.
- Current real-world usage patterns and whether the package remains functional with modern dependencies.
What it is and what it does
alchemy-mock provides utilities to mock SQLAlchemy sessions and query expressions in unit tests, eliminating the need to access a real database during testing. It includes ExpressionMatcher for comparing SQLAlchemy binary expressions (which normally produce another expression rather than a boolean), AlchemyMagicMock for basic session mocking, and UnifiedAlchemyMagicMock for more complex scenarios where sessions are queried multiple times with different filters. The library can stub real data by filtering criteria and partially supports session mutations like add() and add_all().
The package depends on six, sqlalchemy, and setuptools. It is classified as Pre-Alpha and has not been maintained since early 2021, with the last release in November 2019. While it has modest popularity, the abandoned status means bug fixes and compatibility updates are unlikely.
Use it for
- Unit test SQLAlchemy-based code without spinning up a test database or fixtures.
- Assert that query filters were applied correctly by comparing filter expressions directly.
- Stub query results based on specific filter criteria to test conditional logic in data access layers.
- Mock session.add() and session.query() calls to verify ORM operations without persistence.
- Test complex multi-filter query chains by unifying and inspecting all filter calls together.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, but with caution.
The package solves a real testing problem and has low install friction, but it is abandoned and has not been updated since 2021. Install it only if your SQLAlchemy and Python versions are compatible with its last release, and only if you are willing to maintain a fork or workaround if compatibility breaks. For new projects, consider actively maintained alternatives.
Install
alchemy-mock on PyPI
Before you install
Low install friction with three lightweight runtime dependencies. However, the package is abandoned—last release was 2019-11-05 and last commit 2021-01-07. No active maintenance means compatibility issues with newer SQLAlchemy or Python versions are unlikely to be addressed.
Requires SQLAlchemy to be installed; package is abandoned and may have compatibility issues with modern SQLAlchemy or Python versions.
License in practice
MIT license is permissive and poses no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install alchemy-mock
from alchemy_mock.mocking import UnifiedAlchemyMagicMock
session = UnifiedAlchemyMagicMock()
m = session.query(Model)
q = m.filter(Model.foo == 5)
data = q.all()
Verify before relying
- Compatibility with SQLAlchemy versions released after 2021-01-07 is not documented.
- Whether the package works with Python versions beyond 3.6 is unclear given the abandoned status.
- Current real-world usage patterns and whether the package remains functional with modern dependencies.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagessixsqlalchemysetuptools |
| Maintenance | Abandoned 2,474 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 223,061 / month, #9,253 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 :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.6 |
Evidence: alchemy_mock-0.4.3-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 › “sqlalchemy mock testing”
- alchemy-mockProvides mock helpers for SQLAlchemy sessions and expression matchers…
- mock-alchemyProvides mock helpers for SQLAlchemy sessions in unit tests, enabling…
- pytest-mock-resourcesProvides pytest fixtures that spin up real database and service…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also mock-alchemy · django-mock-queries · sqlalchemy-mixins · duckdb-engine · pytest-mock-resources · sqlalchemy-easy-softdelete · flexmock · callee · SQLAlchemy-Continuum · sqlalchemy-filters