-
-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
Describe the Bug
The autoapi v3 mixins are using legacy type annotations that are incompatible with SQLAlchemy 2.0+, causing MappedAnnotationError when models inherit from mixins like GUIDPk and Timestamped
Steps to Reproduce
- Create a model that inherits from autoapi v3 mixins:
from autoapi.v3.mixins import GUIDPk, Timestamped
from autoapi.v3.tables import Base
class MyModel(Base, GUIDPk, Timestamped):
__tablename__ = "my_models"
# ... other fields- Try to import or use the model
- SQLAlchemy will raise MappedAnnotationError
Software Version
<0.4.0
Python Version
Python 3.8
Environment Details
SQLAlchemy: 2.0+
Python: 3.12
autoapi: v3
Relevant Logs or Error Output
File "auto_kms/tables/key_version.py", line 29, in <module>
class KeyVersion(Base, GUIDPk, Timestamped):
File "autoapi/v3/tables/_base.py", line 172, in __init_subclass__
super().__init_subclass__(**kw)
File "sqlalchemy/orm/decl_api.py", line 842, in __init_subclass__
_as_declarative(cls._sa_registry, cls, cls.__dict__)
[...traceback continues...]
sqlalchemy.orm.exc.MappedAnnotationError: Type annotation for "KeyVersion.id" can't be correctly interpreted...Additional Context (Optional)
No response
Confirmation
- I have searched the existing issues for this bug.
- I have provided all necessary information to reproduce the bug.
Reactions are currently unavailable