-
| First Check
 Commit to Help
 Example Codeimport sqlmodel
class User(sqlmodel.SQLModel, table=True):
    id: int = sqlmodel.Field(primary_key=True)DescriptionAn exception is raised python3.14.0rc3 Operating SystemLinux Operating System Detailsdocker container:  SQLModel Version0.25.0 Python Version3.14.0rc3 Additional ContextIn python3.14, the class namespace key  Note that before the class is constructed, this function is known as  https://docs.python.org/3/reference/datamodel.html#object.__annotate__ With the following patch, sqlmodel seems to work properly on python3.14 diff --git a/usr/local/lib/python3.14/site-packages/sqlmodel/_compat.py b/root/_compat.py
index 38dd501..19961c2 100644
--- a/usr/local/lib/python3.14/site-packages/sqlmodel/_compat.py
+++ b/root/_compat.py
@@ -123,6 +123,8 @@ if IS_PYDANTIC_V2:
         object.__setattr__(new_object, "__pydantic_private__", None)
 
     def get_annotations(class_dict: Dict[str, Any]) -> Dict[str, Any]:
+        if (_annotate := class_dict.get("__annotate_func__")) is not None:
+            return _annotate(0)
         return class_dict.get("__annotations__", {})
 
     def is_table_model_class(cls: Type[Any]) -> bool:
@@ -422,8 +424,12 @@ else:
         object.__setattr__(new_object, "__fields_set__", set())
 
     def get_annotations(class_dict: Dict[str, Any]) -> Dict[str, Any]:
+        if (_annotate := class_dict.get("__annotate_func__")) is not None:
+            annotations = _annotate(0)
+        else:
+            annotations = class_dict.get("__annotations__", {})
         return resolve_annotations(  # type: ignore[no-any-return]
-            class_dict.get("__annotations__", {}),
+            annotations,
             class_dict.get("__module__", None),
         ) | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
| Hi @masenf, thanks for the report! I was just looking into this as well, #1578 should fix this, though with a slightly different implementation. In your proposed diff, I don't think you need to adjust anything in the second  | 
Beta Was this translation helpful? Give feedback.
-
| This should now be fixed with the release of  | 
Beta Was this translation helpful? Give feedback.
This should now be fixed with the release of
sqlmodel0.0.27 😎