Skip to content

Commit b1ed8c3

Browse files
author
John Lyu
committed
fix inherit order
1 parent 88670a5 commit b1ed8c3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sqlmodel/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,10 @@ def __new__(
548548
# use base_fields overwriting the ones from the class for inherit
549549
# if base is a sqlalchemy model, it's attributes will be an InstrumentedAttribute
550550
# thus pydantic will use the value of the attribute as the default value
551-
dict_used["__annotations__"].update(base_annotations)
551+
base_annotations.update(dict_used["__annotations__"])
552+
dict_used["__annotations__"] = base_annotations
552553
new_cls = super().__new__(
553-
cls, name, bases, dict_used | base_fields, **config_kwargs
554+
cls, name, bases, base_fields | dict_used, **config_kwargs
554555
)
555556
new_cls.__annotations__ = {
556557
**relationship_annotations,

0 commit comments

Comments
 (0)