Skip to content

SAWarning: nested transaction already deassociated from connection #392

Open

Description

@skissane-medallia

SQLAlchemy-Continuum version

1.7.0

SQLAlchemy version

2.0.51

Database backend and driver

sqlite 3.53.1

Python version

3.14.6

What happened, and what did you expect instead?

Nested transaction use causes SAWarning: nested transaction already deassociated from connection

I found this issue has already been fixed by the sqlalchemy-history fork, see corridor/sqlalchemy-history#121 for their issue and https://github.com/corridor/sqlalchemy-history/pull/122/changes for their fix

Minimal, complete, verifiable example

env -C $(mktemp -d) uv run --python=3.14.6 --with=sqlalchemy==2.0.51 --with=sqlalchemy-continuum==1.7.0 - <<'EOF'
import sqlite3
print(f"sqlite3 version: {sqlite3.sqlite_version}")
import sqlalchemy as sa, sqlalchemy.orm as orm
from sqlalchemy_continuum import make_versioned
make_versioned(user_cls=None)
Base = orm.declarative_base()
class Item(Base):
    __tablename__ = 'item'
    __versioned__ = {}
    id = sa.Column(sa.Integer, primary_key=True)
    name = sa.Column(sa.String)
orm.configure_mappers()
engine = sa.create_engine('sqlite://')
Base.metadata.create_all(engine)
s = orm.sessionmaker(bind=engine)()
with s.begin_nested():
    s.add(Item(name='x'))
s.commit()
EOF

produces output:

sqlite3 version: 3.53.1
<string>:16: SAWarning: nested transaction already deassociated from connection

Full stack trace (if any)


Activity

  1. added
    pinned
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpinned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions