You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Not able to use MappedAsDataclass on a versioned table #375
sqlalchemy.exc.InvalidRequestError: Class <class 'sqlalchemy_continuum.model_builder.NamesVersion'> already defines a '__table__'. ORM Annotated Dataclasses do not support a pre-existing '__table__' element
Removing the versioned prop solves the issue, but then there is no version table. Also, removing the MappedAsDataclass, it works, but then there is no dataclass.
Is there a chance this would get fixed in the future?
classBase(DeclarativeBase):
"""Base class of everything"""passclassDataclassBase(Base, MappedAsDataclass):
"""Base class for all your normal dataclass models"""__abstract__=True# Versioned classes descend from Base, which is *not* a MappedAsDataclassmake_versioned(options={"base_classes": (Base)})
classMyStuff(DataclassBase):
"""One of your models"""__tablename__="stuff"__versioned__= {}
...etc.
Activity
MrTrick commentedon Feb 2, 2026
As discussed in corridor/sqlalchemy-history#146 , the same workaround seems to work also in sqlalchemy-continuum: