skillfed

zope.sqlalchemy

Minimal Zope/SQLAlchemy transaction integration

zope-sqlalchemy v4.1 344.5K downloads/30d#7,372 on PyPI35
License unclear ZPL-2.1 AGING released

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-sqlalchemy

uv

uv add zope-sqlalchemy

poetry

poetry add zope-sqlalchemy

Installing 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

Development Status :: 5 - Production/StableFramework :: PyramidFramework :: Zope :: 3Framework :: Zope :: 5Intended Audience :: DevelopersLicense :: OSI Approved :: Zope Public LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: DatabaseTopic :: Software Development :: Libraries :: Python Modules

Tags

sqlalchemy zope transaction integrationzope transaction manager sqlalchemysqlalchemy session zope transactionsdistributed transactions sqlalchemyzope.sqlalchemy data managerpyramid sqlalchemy transactionstwo-phase commit sqlalchemy
transaction-managementzope-frameworkweb-framework-integration

More Python Modules packages