zope.sqlalchemy
Minimal Zope/SQLAlchemy transaction integration
What it is and what it does
zope.sqlalchemy is a lightweight bridge between SQLAlchemy's session management and Zope's transaction system. It registers SQLAlchemy sessions as participants in Zope's distributed transaction protocol, so that session commits and rollbacks are coordinated with the broader transaction context—useful in Zope-based applications, Pyramid web frameworks using pyramid_tm, and WSGI applications using repoze.tm2. The package does not attempt to define a Zope-specific way to configure engines; it only provides a data manager that hooks into SQLAlchemy's event system via a register() function.
The integration handles both simple commits and two-phase commits. Sessions default to an 'active' state on first use and move to 'changed' when ORM writes occur, avoiding unnecessary database commits. For raw SQL operations, you can manually mark the session as changed or configure it to start in 'changed' state. The package supports scoped sessions (required for threaded web servers) and allows fine-grained control over session lifecycle and transaction boundaries.
Use it for:
- Integrate SQLAlchemy ORM into a Zope application where transactions must be coordinated across multiple resources
- Use Pyramid with pyramid_tm to manage SQLAlchemy session commits alongside other transactional operations
- Implement two-phase commit for SQLAlchemy sessions in distributed transaction scenarios
- Manage long-lived or scoped sessions in WSGI applications using repoze.tm2 for automatic transaction handling
- Coordinate raw SQL operations with Zope transactions by explicitly marking sessions as changed
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates SQLAlchemy sessions with Zope's transaction manager, allowing database operations to participate in Zope's distributed transaction protocol.
Yes, if you are building or maintaining a Zope or Pyramid application that requires SQLAlchemy and distributed transaction support. The package is stable and has no known vulnerabilities, but maintenance is aging (262 days since last release). Install only if you understand both SQLAlchemy and Zope transactions; it is not a general-purpose ORM integration and adds no abstraction layer. Verify ZPL-2.1 license compatibility with your project first.
Install
zope-sqlalchemy on PyPI
pip
pip install zope-sqlalchemyuv
uv add zope-sqlalchemypoetry
poetry add zope-sqlalchemyInstalling zope.sqlalchemy
Before you install
Low install friction with a pure-Python wheel. Maintenance is aging—last release was 262 days ago—but the repository remains active and the package is marked Production/Stable. Suitable for established Zope or Pyramid projects where transaction integration is already a known requirement.
License in practice
Licensed under ZPL-2.1 (Zope Public License), which is OSI-approved but less common than MIT or Apache 2.0. Verify compatibility with your project's license policy before adopting.
Quickstart
from zope.sqlalchemy import register
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
import transaction
engine = create_engine("postgresql://user:pass@localhost/db")
DBSession = scoped_session(sessionmaker(bind=engine))
register(DBSession)
session = DBSession()
session.add(obj)
transaction.commit()
Requires Python 3.10 or later. Assumes familiarity with both SQLAlchemy and Zope's transaction manager; integration is minimal and does not abstract away either system's complexity.
Verify before relying
- Whether the aging maintenance status (262 days since last release) affects stability for current SQLAlchemy versions
- Compatibility with SQLAlchemy 2.0+ ORM patterns beyond the examples shown in the description
Package facts
| License | ZPL-2.1 (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — packaging, SQLAlchemy, transaction, zope.interface |
| Maintenance | aging — 262 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 344,530/month — #7,372 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zope_sqlalchemy-4.1-py3-none-any.whl
Keywords: zope, zope3, sqlalchemy
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
repoze-sendmailCouples email sending with Zope transactions,…
permissive · top 15,000 on PyPI
sqlalchemy-mixinsProvides Active Record-style mixins for…
permissive · top 15,000 on PyPI
transactionProvides a generic transaction management…
unclear · top 5,000 on PyPI
pyramid-tmIntegrates Pyramid web requests with the…
permissive · top 15,000 on PyPI
sqlalchemy-mateSimplifies SQLAlchemy code with helper…
permissive · top 5,000 on PyPI
SQLAlchemySQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
SQLAlchemy-ContinuumSQLAlchemy-Continuum adds automatic versioning…
permissive · top 5,000 on PyPI
casbin-async-sqlalchemy-adapterProvides an asynchronous SQLAlchemy adapter for…
permissive · top 15,000 on PyPI
sqlalchemy-spannerProvides a SQLAlchemy dialect that enables…
permissive · top 5,000 on PyPI
fastcrudFastCRUD provides async CRUD operations and…
permissive · top 15,000 on PyPI