Skip to content

'enable_active_history' should exclude synonyms. SQLAlchemy 2.0 support issue #337

Open

Description

@amnan98

Please see here

configure_mappers() step throws AttributeError: '_ProxyImpl' object has no attribute 'dispatch' for synonyms because this code here:

https://github.com/kvesteri/sqlalchemy-continuum/blob/ccd87070baee40546f3289135e655ecf79b48cf8/sqlalchemy_continuum/builder.py#L194-L205

should also exclude synonyms. Additionally please review the SQLAlchemy 2.0 version of versioned history which does not require use of the private ".impl" attribute.

Code to reproduce error:

from datetime import datetime
from sqlalchemy import String, DateTime, Integer
from sqlalchemy.orm import (
    DeclarativeBase,
    Mapped,
    mapped_column,
    configure_mappers,
    declared_attr,
    synonym,
)
from sqlalchemy_continuum import make_versioned

make_versioned(user_cls=None)


class Base(DeclarativeBase):
    pass


class TableBase:
    id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
    create_time: Mapped[datetime] = mapped_column(DateTime(timezone=True))

    @declared_attr
    def createTime(cls):
        return synonym("create_time")


class A(Base, TableBase):
    __versioned__ = {}
    __tablename__ = "table_a"

    property_a: Mapped[str] = mapped_column(String)
    propA = synonym(property_a)


configure_mappers()

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

    pinned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions